134k views
18 votes
Which entry by the user will cause the program to halt with an error statement?

# Get a guess from the user and update the number of guesses.
guess = input("Guess an integer from 1 to 10: ")
guess = int(guess)

Multiple Choice
a. 22
b. 2.5
c. -1
d. 3

2 Answers

1 vote

Answer:

2.5 for it is a float not an integer

Step-by-step explanation:

User Littin Rajan
by
3.9k points
5 votes

Answer:

2.5

Step-by-step explanation:

The program expects an integer input from the user. This is evident in the second line where the program attempts to convert the input from the user to an integer value.

Please note that the integer value could be negative or positive.

Options (a), (c) and (d) are integer values while option (b) is a floating point value.

Hence, option (c) will halt the program and raise an error because it is not an integer.

User Mattio
by
4.6k points