- 2
Can you help me please😰.. slove this code..😩😱😢
Build program code to solve this problem. Test whether the temperature entered is a cold, medium or hot temperature where the cold temperature is 25 ° c and below, the medium temperature is between 26 ° c to 40 ° c, while the hot temperature is 41 ° c and above. is this code correct .... which I have create it😅🙃🤔 https://code.sololearn.com/cQ5zd03634Cx/?ref=app
11 odpowiedzi
+ 12
NURUL AIN SYAFIQAH BINTI MUHAMMAD NAZIR ,
since you have finished the tutorial "python for beginners" you should be able to correct your code by yourself. read the error messages and debug your code step by step.
some of the issues:
▪︎ no input() function uesd
▪︎#include temperature ???
▪︎missing colon at the end of conditional statement >> if ... else ...
▪︎float temp ; incorrect syntax, no need to declare variables this way
▪︎no need to have semicolon at the end of a line
▪︎incorrect use of >> else
▪︎...
+ 7
Your code has many flaws, does not look like Python at all.
Python is dynamically typed, you do not need to declare variables along with their type. The type is guessed by the runtime, when the value is assigned to the variable.
You need to ask for user input with the input() function, and because it is a string, you convert it with the float() function.
In your conditions you need to use elif except for the last one.. the conditions don't have to be in parentheses.
if condition:
...
elif condition2:
...
else:
...
And we don't use any semicolons in Python.
+ 6
temp = float(input())
+ 3
#Try this code:
temp = float(input())
print("Input days temperature : "+str(temp));
if temp<0:
print("Freezing weather.");
elif temp<10:
print("Very cold weather.");
elif temp<20:
print("Cold weather.\n");
elif temp<30:
print("Normal in temp.");
elif temp<40:
print("Its Hot.");
else:
print("Its very hot.");
+ 3
MD. Ferdous Ibne Abu Bakar Thank you very much...😄😊😉👍👍👍
+ 3
Your code has many flaws, does not look like Python at all.
Python is dynamically typed, you do not need to declare variables along with their type. The type is guessed by the runtime, when the value is assigned to the variable.
You need to ask for user input with the input() function, and because it is a string, you convert it with the float() function.
In your conditions you need to use elif except for the last one.. the conditions don't have to be in parentheses.
if condition:
...
elif condition2:
...
else:
...
And we don't use any semicolons in Python.🙃🙃
+ 2
Hello
+ 2
suhu = float(input())
print("Masukan suhu : "+str(suhu))
if suhu<=25:
print("cold")
elif suhu<=40:
print("moderate")
elif suhu>40:
print("hot")
__try this method
+ 1
Tibor Santa How to do that..😰😕
+ 1
Welcome
+ 1
remember that in 25 it is still cold....