Font size
Worksheetspython excercise varible
Total questions: 12
Worksheet time: 6mins
What is the correct file extension for Python files?
.pp
.py
.pt
.php
Insert the missing part of the code below to output "Hello World".
(a) ("Hello world")
Which character is used to define a Python comment:
'
//
#
/*
What is a correct way to declare a Python variable?
var x = 5
#x = 5
$x = 5
x = 5
True or False:
Variable names are not case-sensitive.
TRUE
FALSE
Which is NOT a legal variable name?
my-var = 20
my_var = 20
Myvar = 20
_myvar = 20
Create a variable named "carname" and assign the value "Volvo" to it.
(a)
Create a variable named x and assign the value 50 to it.
(a)
If x = 5, what is a correct syntax for printing the data type of the variable x?
print(dtype(x))
print(type(x))
print(x.dtype())
The following code example would print the data type of x, what data type would that be?
int
str
float
The following code example would print the data type of x, what data type would that be?
str
int
string
float
The following code example would print the data type of x, what data type would that be?
str
bool
int
double
