Write a program that checks if the water is boiling. Take the integer temperature in Celsius as input and output "Boiling" . | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
- 4

# Write a program that checks if the water is boiling. Take the integer temperature in Celsius as input and output "Boiling" .

Write a program that checks if the water is boiling. Take the integer temperature in Celsius as input and output "Boiling" if the temperature is above or equal to 100. I hAve tried coding the Above. It first stArted like this: temp= 110 if temp>= 100: print("Boiling") temp=99 if temp>=100: print("Boiling"). # This prints the Output Boiling. And I see A Green Tick MArk in the Output Section like #✔Test 1(which must meAn it is correct) . And then mArked ❌ in Test 2 with other result input = 99, expected output= No Output,but your Output is Boiling.

1st Feb 2021, 5:54 AM
We Doru
29 ответов
+ 17
temp = int(input()) if temp >=76: print() if temp >=100: print("Boiling") try this code
25th Sep 2022, 9:02 AM
APPANNA VISHAL
+ 4
temp = int(100) if temp >= 100: print ("Boiling")✓ But Test case 1: And test case 4 are hidden showing errors So please help me can I take any input for test case 4
30th Sep 2022, 9:09 AM
Lovely Sairohith
+ 3
CAPITAL B FOR BOILING 🤦🏽‍♂️
20th Jan 2022, 1:50 AM
shattered Glass
+ 3
if temp >=76: print() if temp >=100: print("Boiling")
13th Oct 2022, 2:42 PM
Sumit Prajapati
+ 1
The parameter inside the input() is just a text that will appear on your interactive prompt or shell (it is not the value) and it is optional: Here is an example if I place a parameter, in interactive shell (not working in code playground): CODE: x = input("What is your name? ") print("Hello" + x) SHELL/PROMPT: >> What is your name? | # This will wait for your input, for example if I want to input "Red" >> What is your name? Red >> Hello Red
1st Feb 2021, 8:19 AM
noteve
+ 1
Scanner sc = new Scanner(System.in); int temp = sc.nextInt(); if(temp>=100){ System.out.println("Boiling"); } else { System.out.println("Not boiling"); }
26th Mar 2023, 11:23 AM
Vansh kumar
0
In challenges, you have to get the input: temp = int(input()) input() --> takes input as string int() --> converts the input string to integer
1st Feb 2021, 5:56 AM
noteve
0
But me writing temp=100 still should be correct, in terms of the python because integers cAn be written without quote and directly displayed As temp= 100.isn't this correct from the basic, but SoloLeArn shows wrong becauss they want us to follow the task exactly even though the way I put must be correct. Need clarification
1st Feb 2021, 6:02 AM
We Doru
0
You don't need to type each input each test cases in challenges, just get the input and code to meet the expected output. # Try this: temp = int(input()) if temp >= 100: print("Boiling") # Think of the test cases as other people who will input something to test and judge your code. # If test cases 1 is 100 Your program will automatically get that 100 as input: temp = int(input()) <--- 100 (from test case) Same with other values temp = int(input()) <--- 99 (from test case)
1st Feb 2021, 6:08 AM
noteve
0
Alright, I tried this- temp = int(input(110)) if temp>=100: print("Boiling") #This prints out 110Boiling.
1st Feb 2021, 6:09 AM
We Doru
0
Remove the 110 inside the int(input()), if you try that code on interactive prompt/shell, 110 will serve as your text input. However, in challenges we don't need one, we just have to get the input; temp = int(input())
1st Feb 2021, 6:11 AM
noteve
0
temp = int(100) if temp>=100: print("Boiling") temp= int(99) if temp>=100: print("Boiling"). It still gives me One output for the tAsk, thAt is Boiling. But I Also need No Output which is the expected Output of the chAllenge. Otherwise Test2 is still shown in ❌ MArk
1st Feb 2021, 6:28 AM
We Doru
0
Just copy this one and paste to your solution, and maybe you'll understand: temp = int(input()) if temp >= 100: print("Boiling")
1st Feb 2021, 6:33 AM
noteve
0
Bonus Question:But exActly how. How did thAt if stAtement knows what to print without A prior variable being defined. For example I define a variable f = O. And then next I code if f=O , print(8). the mission will be Accomplished,but it All stArted from f=O. Is it due to the nature of python to identify 'temp' As temperature in degree celcius like it is A speciAl vAriable and not arbitrary one. Right . Why do the temp do not require no input in empty parenthes in temp = int(input()) .