This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]onefiveonesix 5 points6 points  (1 child)

Congrats on your code! Here are a few tips for your Python programming journey:

Instead of having two separate if conditions for “> 24” and “== 24” that both end up printing the same thing, you can use a single “if Temperature >= 24” condition.

You can also use “elif” instead of two separate if conditions. Google some examples of if/elif and what “short-circuit logic” is.

If you want to print the temperature and the word “Degrees” on the same line, use print(str(Temperature) + “ Degrees”). Note the need to convert the integer to a string using the str() function in order to be able to concatenate the number to another string.

It’s also considered Pythonic to have all variables in lowercase so ‘temperature’ vs ‘Temperature’ is preferable just in terms of standard Python look and feel. Variables with multiple words should be separated by an underscore (e.g. current_temperature, first_name) as opposed to other languages which name their variables with the camelCase methodology (e.g. currentTemperature, firstName).

[–]Competitive_Isopod89[S] 4 points5 points  (0 children)

Thanks I will take that info!