- 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.
30 ответов
+ 17
temp = int(input())
if temp >=76:
print()
if temp >=100:
print("Boiling")
try this code
+ 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
+ 3
CAPITAL B FOR BOILING 🤦🏽♂️
+ 3
if temp >=76:
print()
if temp >=100:
print("Boiling")
+ 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
+ 1
Scanner sc = new Scanner(System.in);
int temp = sc.nextInt();
if(temp>=100){
System.out.println("Boiling");
} else {
System.out.println("Not boiling");
}
0
In challenges, you have to get the input:
temp = int(input())
input() --> takes input as string
int() --> converts the input string to integer
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
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)
0
Alright, I tried this-
temp = int(input(110))
if temp>=100:
print("Boiling") #This prints out 110Boiling.
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())
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
0
Just copy this one and paste to your solution, and maybe you'll understand:
temp = int(input())
if temp >= 100:
print("Boiling")
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()) .
0
temp = int(input())
if temp > 99:
print("Boiling")
0
Finally worked it out
0
temp = int(input())
if temp >= 100:
print('Boiling')
else:
print(' ')
in this program it will only print "Boiling" when the input temperature is above 100, else it won't print anything.
0
ESTE ES EL CODIGO CORRECTO, ES LA SOLUCION¡¡¡
temp = int(input())
if temp >=76:
print()
if temp >=100:
print("Boiling")
0
temp = int(input())
if temp >= 100:
print("Boiling")
This code worked out for me just check it out.
0
temp = int(input())
if temp >= 100:
print ('Boiling')
else:
print ('')