python if statements | Sololearn: Learn to code for FREE!
0

python if statements

Task:take the integer temp in celcius as input and output boiling water if the temperature is above or equal to 100 Sample input is 105 My code: temp=int(input(105) If temp>=100 print(‘Boiling’)

11th Dec 2021, 8:26 PM
Nua
11 Answers
+ 8
What is your question? I think your code won't work: * number from input() * missing closing ) of int() * if is spelt wrong ("If" is not correct) * : in after the if-condition is missing * print() is not indented into the if-block
11th Dec 2021, 8:43 PM
Lisa
Lisa - avatar
+ 2
It should work, if you remove the 150 in input and add one ) on the first line. Add a : at the end of the if statement. And you should indent the print statement.
11th Dec 2021, 8:40 PM
Paul
Paul - avatar
+ 2
Remove 105 and put : after line 2
11th Dec 2021, 8:51 PM
Paul
Paul - avatar
+ 2
Please have another look at my previous comment and look at how "if" is spelt and where : needs to be placed The ' in your printed string don't look right...
11th Dec 2021, 8:53 PM
Lisa
Lisa - avatar
+ 1
Thank you
11th Dec 2021, 8:54 PM
Nua
+ 1
I fugured it out thank you very much i may ask noob question but im still only a begginer just learning
11th Dec 2021, 8:55 PM
Nua
+ 1
# just write it like this: temp = int(input()) if temp > 100: print('Boiling') else: print('Stable') # but you can make a one-line version of it: (temp > 100 and print('Boiling')) or print('Stable') #this will evaluate the value of int(input()) and it can be thought as: (True/False & True) or True
12th Dec 2021, 6:48 AM
Ervis Meta
Ervis Meta - avatar
0
Okay i know fixed the code temp=int(input(105)) If:temp>=100 print(‘Boiling’) What am i missing now??
11th Dec 2021, 8:50 PM
Nua
0
I removed 150 still wrong idk why
11th Dec 2021, 8:52 PM
Nua
0
Oh i put : after 100? At 2nd line??
11th Dec 2021, 8:53 PM
Nua
0
This code is not work.Because your code is not correct.Some problems in your code.
13th Dec 2021, 8:15 AM
Abdun Nur Porag
Abdun Nur Porag - avatar