def mainMenu(): print("1. Create Username") print("2. Find Factorial") print("3. Find the Area") print("4. Find the Circumference") print("5. Exit") while True: try: selection =int(input("Enter a Choice: ")) if selection==1: username() elif selection==2: factorial() elif selection==3: area() elif selection==4: circumference() elif selection==5: exit else: print("Invalid Choice, Enter 1-5") mainMenu() except ValueError: print("Invalid Choice, Enter 1-5") print("**Create a Username**") #Message to state the use is creating a username. def username(): print("enter name") First = input("Enter your first name: ") #Asking the user for their first name. Last = input("Enter your last name: ") # Asking the user for their last name. first_letter = First[0] #Creating a Variably and assigning the first initial to it. Sur = Last #Creating a variable with a value of the last name. username = (first_letter + Sur) #Creating the username which adds the first initial and last name. print("**This is Your Username**") print(username) #Username is taking the first initial of the first name and the entire surname. print("Find The Factorial") #Message stating we are finding the Factorial. def factorial(num): if num == 1: return num else: return num * factorial(num - 1) #The number entered mulitpled by the next number down and so on to 1. num = int(input("Enter A Number: ")) #Asking the user to enter a number to find the factorial. if num < 0: print("Factorial Cannot Be Completed") elif num == 0: print("Factorial of 0 is 1") else: print("Factorial of", num, "is: ", factorial(num)) print("Finding The Area of A Triangle")#Find the area message. def area(): #Find the area of a trianlge print("Find the Area of a Triangle") Width = int(input("Enter The Width in cm: ")) #Asking the user to input the Width. Height = int(input("Enter The Height in cm: ")) #Asking the user to input the Height. #Enter the Width and Height Dimensions of the triangle. area = (Width * Height / 2) #Area Calculation, Width multiplied by Height then divided by 2. print(area) print("Find The Circumference of A Circle")#Find the circumference message. def circumference(): #Find the circumference. print("Find the Circumference") Radius = int(input("Enter the radius in cm: ")) #Asking the user to enter the Radius value. Circumference = Radius * 2 * 3.14 #Circumference calculation is radius times two then multiplied by pi or 3.14. print(Circumference)

The 4 functions run but it misses out the menu at the start. Apologises for the terrible code I have only been doing this for about 3 weeks. So any help with this would be greatly appreciated,

Thank you,

Blair.

This post has been edited by **modi123_1**: 17 October 2019 - 09:14 AM

Reason for edit:: In the future, please use the [code] tag button in the editor.