Q. 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.)
Answer =
Correct code:-
probability = float (input("Type a number between 0 and 1: ")) print("Out of 150 tries, the odds are that only", (probability * 150), "will succeed. ")
this code is giving error
ReplyDeleteData type should be float.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )