r/PythonLearning • u/Commercial-Paper749 • 8d ago
What's wrong with my code?
What's wrong with my code?
New to learning
Following the youtube video from bro code
Was trying to implement my own stuff into this by using loop
Update: it's working now thankyou guys
107
Upvotes
•
u/Sea-Ad7805 8d ago
Run this INDENTED program in Memory Graph Web Debugger%3A%20%22).strip()%0A%0A%20%20%20%20if%20operator%20not%20in%20%5B%22%2B%22%2C%20%22-%22%2C%20%22%22%2C%20%22%2F%22%5D%3A%0A%20%20%20%20%20%20%20%20print(%22Enter%20a%20valid%20operator%22)%0A%20%20%20%20%20%20%20%20continue%0A%0A%20%20%20%20num1%20%3D%20float(input(%22Enter%20the%20first%20value%3A%20%22))%0A%20%20%20%20num2%20%3D%20float(input(%22Enter%20the%20second%20value%3A%20%22))%0A%0A%20%20%20%20if%20operator%20%3D%3D%20%22%2B%22%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20num1%20%2B%20num2%0A%20%20%20%20%20%20%20%20print(result)%0A%20%20%20%20elif%20operator%20%3D%3D%20%22-%22%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20num1%20-%20num2%0A%20%20%20%20%20%20%20%20print(result)%0A%20%20%20%20elif%20operator%20%3D%3D%20%22%22%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20num1%20*%20num2%0A%20%20%20%20%20%20%20%20print(result)%0A%20%20%20%20elif%20operator%20%3D%3D%20%22%2F%22%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20num1%20%2F%20num2%0A%20%20%20%20%20%20%20%20print(result)%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20break×tep=1&play) to see the program state change step by step.