What is the data type of decimal numbers
float
What is a variable
Variable is storage container
What's the operator for modulus
% (aka remainder)
what would be the first thing Python does here:
print(2+3**3**2)
3**2, as ** is right-associative operator
What is the symbols for comment?
#
What's the data type of a variable?
a=400.56
float
which one is the valid variable name?
_sa_area
&sa_area
1sa_area
_sa_area
What's the operator for integer division
// (aka quotient)
What is the str() function?
type casting function, returns String value of the argument
Which operator is evaluated first:
a= 10*3+7/5-4
a) =
b)/
c)*
d)-
* , then /, then + and -, and finally =
(a= 10*3+7%5-4)
what are the 3 basic data types in Python
int,float and string
In Python, a variable may be assigned a value of one type, and then later re-assigned a value of a different type:
True or False
True
What's the output of this
a=21/2
b=21%2
c=21//2
10.5,1,10
What's the value of this expression?
2+3*10+10%2*10
32
What is string concatenation
the process of appending one string to the end of another string
correct or incorrect?
a=20.3
print("The value of a is"+str(a))
correct
What's the type() function used for ?
to tell the data type of a variable, i.e. class int etc.
what's the output of this?
20+10*3-(15-7)+27//2
55
What's the value of this expression?
118+2+10*19*(10+10)*2%2
120
What's the output of this?
name="100"
print("The value of the name is\n" +name)
The value of the name is
100
what's the output of this?
a=int(123.45)
b=12.3
print(a+b)
135.3
x=100
y=35
y+=x
print(y)
135 (as += is short for y=y+x)
What 7 arithmetic operators do we have in python
+,-,*,**,/,//,%
What's the output of this?
a=200.34
b=200.3
print(a==b)
False
What's the output?
a=100
b=200
print(a>=b)
False