Quantcast
Channel: Calculator final project in Python - Code Review Stack Exchange
Viewing all articles
Browse latest Browse all 4

Answer by 200_success for Calculator final project in Python

$
0
0

You are using function calls as if they were goto labels. That is a huge sin: it makes your program spaghetti code. If you want a loop, then write a loop. For example, main() should look like:

def main():
    while True:
        #Menu
        print("=======================")
        print("Welcome to Calculator")
        print("By: Tyler Harris")
        print("=======================")
        print("Menu: ")
        print("[1] Calculator")
        print("[2] Instructions")
        print("[3] Exit")
        print("=======================")
        choice = input("Please select an option: ")
        if choice == '1':
            calculator()
        elif choice == '2':
            instructions()
        elif choice == '3':
            print("Thank you for using Calculator.")
            break
        else:
            print("Not an option, try again:")

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>