Computer Science

Program is giving a weird result of "0.50.50.50.50.50.50……….". Correct it so that it produces the correct result which is the probability value (input as 0.5) times 150.

probability = input("Type a number between 0 and 1: ")
print("Out of 150 tries, the odds are that only", (probability * 150), "will succeed.")

[Hint. Consider its datatype.]

Python Data Handling

10 Likes

Answer

The corrected program is below:

probability = float(input("Type a number between 0 and 1: "))
print("Out of 150 tries, the odds are that only", (probability * 150), "will succeed.")

Answered By

9 Likes


Related Questions