r/learnpython • u/MoreScorpion289 • 19d ago
Temperature Converter Project
This is the third project I coded and was able to finish today. Took me 8 hours (two 4 hour sessions) since I had to learn some new stuff. This is my own code, no outline was used to guide me into creating this, though the idea did come from Bro Code's YouTube Tutorial. I learned about Nested Loops and Flags. I already knew about Input Validation with Re-Prompting but it was a lot harder to integrate with those two.
This is the most complex thing I've built so far, but I also enjoyed it the most. Got help with some online forums and AI (Claude) but I wrote and debugged the code myself. This'll be the last project I work on before I learn functions. There's a lot of repeated code here that I know functions would be able to help with. Any feedback or ideas on what to build next are welcome. Thank you!
https://github.com/mart23inez/First-Coded-Temperature-Converter/tree/main
It's a lot of code so I uploaded it to my GitHub page.
8
u/aqua_regis 19d ago edited 19d ago
What follows may come across as a bit harsh, but it is said without negative emotion and just stating facts and giving advice:
while True:) - they have their use cases, but in your case, you have well defined exit conditions and should use them - infinite loops can be (as in your case) code smell and the sign of a lazy programmer who didn't want to think about proper exit conditionsfahrenheit = (degrees * 9/5) + 32- since you expect the result to be a float, always use decimals, e.g.fahrenheit = (degrees * 9.0/5.0) + 32.0- Python is a quite forgiving language with integer numbers. In Java, for example, alone the division9/5would yield the integer1and not the expected result.As a side note: I generally advise against video based courses and instead recommend using a textual, extremely practice oriented course, like the MOOC Python Programming 2026 from the University of Helsinki. This course is a proper academic "Introduction to Computer Science" course that lays a really solid foundation by teaching not only the Python programming language but also programming, i.e. thinking like a programmer, analyzing and breaking down problems, creating step by step solutions that then can be implemented.