Help with boiling water puzzle. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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!

2nd Feb 2021, 6:17 PM
Greg
Greg - avatar
6 Answers
+ 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
2nd Feb 2021, 6:22 PM
ARNAV SINGH KAINTH
ARNAV SINGH KAINTH - avatar
+ 2
How about adding else: print("")
3rd Feb 2021, 3:26 AM
David Ashton
David Ashton - avatar
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.
2nd Feb 2021, 11:47 PM
Greg
Greg - avatar
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
3rd Feb 2021, 4:04 AM
ARNAV SINGH KAINTH
ARNAV SINGH KAINTH - avatar
0
Hey guys thanks for the replies. I've sorted it now! Cheers!
3rd Feb 2021, 2:55 PM
Greg
Greg - avatar
0
temp =int(input()) if temp>=100: print("Boiling") if temp<100: print("Not Boiling") This is the right answer
20th Sep 2023, 12:42 PM
Shaik Salma
Shaik Salma - avatar