100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
TAMU ENGR 102 (python coding) Questions and Answers $14.49   Add to cart

Exam (elaborations)

TAMU ENGR 102 (python coding) Questions and Answers

 2 views  0 purchase
  • Course
  • TAMU
  • Institution
  • TAMU

TAMU ENGR 102 (python coding)

Preview 2 out of 7  pages

  • September 14, 2024
  • 7
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • TAMU
  • TAMU
avatar-seller
jw638729
TAMU ENGR 102 (python coding)

x += c – answer x = x + c

a -= 3 – answer a = a - 3

x *= 4 – answer x = x * 4

y /= 3 – answer y = y / 3

what are some different types of variables? - answer Integers, Floating-Point, Strings,
Booleans

what is an integer? - answer whole numbers, no decimals/fractions

what are floating-point numbers? - answer numbers with a decimal point

what is Boolean? - answer single value either true or false

what are strings? - answer way of describing text (you can use either single quotes or
double quotes)

float(3) - answer value becomes 3.0

int(4.9) - answer has the value 4

str(10*1.0) - answer has the value '10.0'

what is the Boolean value of true/false? - answer true is assumed to have the value 1
false is assumed to have the value 0

x=3
y=4
print(str(x) + ':' + str(y)) - answer3:4

how to ask the user for input? – answer x = float(input())

== - answer equal to

!= - answer inequality

a = 10
b = 10

, c = 20
d = ((a>b) and (b<=c)) or (not((((c<=a+b) and (a==10)) or ((b==10) and c!=10))))
print(d) - answerfalse

temperature = 100
is_hot = (temperature > 85)
if is_hot:
print("It's hot")
if not is_hot:
print("It's not hot") - answerIt's hot

when to use if-elif-else statements? - answerwhen you have multiple "cases" of the
same type

when to use nested statements? - answerwhen there is a clear "order" of checks:
checking A then B

what is the "while" statement? - answercreates a loop and will repeat a set of
instructions infinitely until the condition is false.
while <condition>:
<things to do>

a=0
while a == 0:
print("About to change a")
a=1
print("Changing a back to 0")
a = 0 - answerAbout to change a
Changing a back to 0
About to change a
Changing a back to 0
... (an infinite loop)

what is the for loop designed to do? - answerto perform specific statements for a
determined number of iterations

sum = 0
for i in range(10):
sum += i+1
print(sum) - answer55

what are nesting loops? - answerthat is when you nest one loop inside another

for i in range(3):
print("i is", i)
for j in range(3):

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller jw638729. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $14.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73091 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$14.49
  • (0)
  Add to cart