QuizΒΆ
Check your understanding of data reading in Python by doing the following short quiz:
What happens when we run the next program and enter 2
?
a = input()
print(a+3)
The program will print 5
The program will print 23
An error will occur when trying to add a string and a number
What happens when we run the next program and enter 2
?
a = input()
print(a+'3')
The program will print 5
The program will print 23
An error will occur when trying to add a string and a number
When is the integer int(a) greater than the real number a?
When the first decimal place of a is greater than or equal to 5
When the number a is negative
When the number a is positive
When the number a is single-digit
When the difference between a and int(a) is greater than 0.5