0
Help with boiling water puzzle.
Hello world! first post, and I could really use some help. Basically I'm doing the boiling water puzzle, and apparently only part of my code is correct. temp = int(input()) if temp: 100>=100 print('Boiling') For test case 1: it says that is correct since 110 is greater than or equal to 100. For test case 2:it says that the expected output should be blank, which i understand, but I'm not sure where I'm going wrong for it to display that? Any explinations would be greatly appreciated! thanks!
6 Antworten
+ 2
temp=int(input())
if temp >= 100:
print("Boiling")
else:
print("Nothing")
Greg The Above Code Means That The Program Takes The Value Of A Variable Names Temp And Checks The Condition Whether Temp Is Greater Than Or Equal To 100. If The Condition Is True, Boiling Will Be Written. I Changed The Code And Added The Else Statement. What This Means Is If Temp Is Less Than 100, It Will Print The Statement Within Else Statement i.e. Nothing Will Be Printed. Hope This Helps You
+ 2
How about adding
else:
print("")
0
Hi,
I very much appreciate the reply, however I still not understand where I'm going wrong? I've got the code to print boiling, what I can't do is get it to print nothing.
0
Greg Can You Kindly Post The Whole Problem Statement Here. So That I Can Get An Idea Of The Question And Answer It Correctly
0
Hey guys thanks for the replies. I've sorted it now!
Cheers!
0
temp =int(input())
if temp>=100:
print("Boiling")
if temp<100:
print("Not Boiling")
This is the right answer