+ 1
This is my very first program. Any suggestions or errors help would be greatly appreciated.
3 Answers
+ 2
Hey, looks good!
Though I am getting an error on Line 13:
File "..\Playground\", line 13, in <module>
user_input = input("Enter the operation you want to carry out: ")
EOFError: EOF when reading a line
There are a few things I would suggest doing differently.
1. Declare all variables at the top by: float num1 and so on.
As the variables are in one place so you can reference them easier.
It will also make you code easier to read.
2. Have Line 13 above the While True.
This means that it will always ask for an input, and not be stopped if a bug caused the âwhileâ to never run.
3. If you want to advance this have a look at functions. This will allow you to create a section of code that can then be re-used in multiple places without using copy & paste.
This will help in the long run, especially when you create longer more complex code.
Its been a while since i have coded in python so Iâm not sure how to solve the specific error I got but otherwise I hope this helps!đ
+ 1
Thats why I made an exit command which when entered will stop the program and will not show error.
+ 1
Thanks for help! đ