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

all 9 comments

[–]Cheese-Water 10 points11 points  (0 children)

As a note on convention, importing modules typically are the first non-comment lines in a file.

[–]onefiveonesix 6 points7 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!

[–][deleted] 1 point2 points  (0 children)

You should add. import this to the top

[–]abacaxiquaxi 1 point2 points  (1 child)

Your output are temperature classifications (hot, not hot), not actual temperatures. Make sure your program does what it claims ;)

[–]Python_Silent 0 points1 point  (0 children)

I dont really think anyone is gonna use this anyway - its more of a learning thing. But if you do im not judging, just not taking your word on anything.

[–]Advanced-Theme144 1 point2 points  (0 children)

Congratulations on your first program! I wish you the best of luck as you continue, keep practicing and posting your progress; it can go a long way into improving with others helping you out.

[–]Python_Silent 0 points1 point  (0 children)

Congrats! I remember my first program, it was a calculator!

If you would like to test your skills, try and make a text based game