User:Praveer-mathur-9f3d@uni-bonn.de

From HPC Wiki
Revision as of 14:21, 6 March 2026 by Praveer-mathur-9f3d@uni-bonn.de (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Short Quiz: Variable Assignment

What values do the two variables "mass" and "age" have in the following lines?

mass = 47.5
print(mass)

Click and submit to see the answer

age = 122
print(mass, age)

Click and submit to see the answer

mass = mass * 2.0
print(mass, age)

Click and submit to see the answer

age = age - 20
print(mass, age)

Click and submit to see the answer

Short Quiz: Data Types

planet = 'Earth'
What datatype does the variable planet have?

Integer
String
Boolean
Float

apples = 5
What datatype does the variable apples have?

Integer
String
Boolean
Float

distance = 10.5
What datatype does the variable distance have?

Integer
String
Boolean
Float

false = 7 > 2
What datatype does the variable false have?

Integer
String
Boolean
Float

Short Quiz: Boolean Operations

var1 = True
var2 = False
What is the value of each variable after each of the following print statements?

print(var1, var2)

Click and submit to see the answer

var2 = var1 or var2
print(var1, var2)

Click and submit to see the answer

var1 = var1 and not var2
print(var1, var2)/code>

Click and submit to see the answer

var1 = not(var1 and not var1)
print(var1, var2)

Click and submit to see the answer