+ 1

This is my very first program. Any suggestions or errors help would be greatly appreciated.

https://code.sololearn.com/ctWl6lN7CC96/?ref=app

1st Jul 2019, 7:59 PM
Rohit Panchal
Rohit Panchal - avatar
3 odpowiedzi
+ 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!😁
1st Jul 2019, 9:26 PM
Rebecca Stancliffe
Rebecca Stancliffe - avatar
+ 1
Thats why I made an exit command which when entered will stop the program and will not show error.
2nd Jul 2019, 4:32 AM
Rohit Panchal
Rohit Panchal - avatar
+ 1
Thanks for help! 😊
2nd Jul 2019, 4:34 AM
Rohit Panchal
Rohit Panchal - avatar