Font size
Worksheets02. Python Variables, Data Types, and User Input Quiz
Total questions: 10
Worksheet time: 6mins
What is a variable in Python?
A function that performs calculations
A type of data structure
A storage location for data
A fixed value that cannot change
Which operator is used for modulus in Python?
/
*
%
-
msg = "Welcome to the Data Science Class"
print ( msg.capitalize() )
The output of the code is ...
Welcome to the data science class
welcome to the data science class
WELCOME TO THE DATA SCIENCE CLASS
Welcome To The Data Science Class
error
name = input("Input name: ")
age = input("Input age: ")
print( name + "was born in" + (2021 - age) )
If the user enters Budi and 25 in the terminal, which is the correct output for the code above?
Budi was born in 1996
Budi was born in 25
error
Budi was born in (2021 - age)
Budi was born in 2021-25
x = "2.5"
x = int(x)
What the type of x ?
error
integer
float
string
boolean
What is the output of the following code: print(type(3.14))?
error
float
int
string
msg = "Data Science Purwadhika"
print( msg[-4:].title() )
(a)
x = 10 % 2
x /= 5
print(x)
(a)
a, b = 5, 2
print(b+2, a-2)
4 3
7 4
3 4
4 7
error
Which is the correct way to write variables?
myv4r
_myvar
myv@r
1myvar
my var
