No student devices needed. Know more
16 questions
print ("7" * 4)
7777
28
error
print("4*6")
46
24
4*6
error
print(3*8)
38
24
3*8
error
print ("the cost is £"+ str(2*5))
the cost is £10
the cost is £ 7
the cost is £ 10
the cost is £ 2*5
print("Mr."+"John")
error
Mr. John
Mr.John
print("the value is"+ 5)
the value is5
error
the value is 5
.......... this function converts a variable to string.
int()
float()
bool()
str()
.......... this function converts a variable to integer.
int()
float()
bool()
str()
.......... this function converts a variable to float.
int()
float()
bool()
str()
A programmer would like to set a distance value to a variable. What variable type should he use?
string
integer
float
boolean
A programmer would like to set cost of a product to a variable. What variable type should he use?
string
integer
float
boolean
A programmer would like to set a quantity of crisps bags to a variable. What variable type should he use?
String
Integer
Float
Boolean
.............. calculates and prints the average of two numbers
print((num1+num2)/2)
print(num1+num2/2)
print(num1+num2)
num=5
num=str(num)
on line 1, the type of Num variable was integer but on the second line it was converted to ......
boolean
string
float
You can multiply a string by a number. The string will be printed multiple times equal to that number e.g. print ("Hi"*3) will output HiHiHi
False
True
Multiplying two strings will generate error
Ture
False
Explore all questions with a free account