Difference between revisions of "User:Praveer-mathur-9f3d@uni-bonn.de"
Jump to navigation
Jump to search
What datatype does the variable planet have?
What datatype does the variable apples have?
What datatype does the variable distance have?
What datatype does the variable false have?
| Line 4: | Line 4: | ||
{{hidden begin | {{hidden begin | ||
| − | |title = <code>mass = 47.5 <br> | + | |title = <code>mass = 47.5 <br> print(mass)</code> |
}} | }} | ||
<quiz display=simple> | <quiz display=simple> | ||
Revision as of 17:58, 9 March 2026
Short Quiz: Variable Assignment
What values do the two variables "mass" and "age" have in the following lines?
mass = 47.5
print(mass)
age = 122
print(mass, age)
mass = mass * 2.0
print(mass, age)
age = age - 20
print(mass, age)
Short Quiz: Data Types
planet = 'Earth' What datatype does the variable planet have?
apples = 5 What datatype does the variable apples have?
distance = 10.5 What datatype does the variable distance have?
false = 7 > 2 What datatype does the variable false have?
Short Quiz: Boolean Operations
var1 = True
What is the value of each variable after each of the following print statements?
var2 = False
print(var1, var2)
var2 = var1 or var2
print(var1, var2)
var1 = var1 and not var2
print(var1, var2)
var1 = not(var1 and not var1)
print(var1, var2)
Short Quiz: String Concatenation
str1 = "Uni"
str2 = "Bonn"
str3 = str2 + str1
str4 = str1 * 3
What output do you expect after doing
print(str3)?
What output do you expect after doing
print(str4)?