Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python And send it to my email LOOL.8@hotmail.com Sample Program Execution

ID: 3736141 • Letter: U

Question

Using python And send it to my email LOOL.8@hotmail.com Sample Program Execution: he purpose of program: (not shown here) ease c nenu lease choose fron the menu : Draw a single bar of synbol Draw a single bar of symbol Print numbers from n tom Draw a rectangle Draw a right triangle Quit Print numbers fron n to m : Draw a rectangle : Draw a right triangle : Quit er your choice: 2 nter the first bound: 2 nter your choice: ter the second bound:7 is an invalid choice is the sequence: 3456 lease choose from the nenu : Draw a single bar of symbol ease choose fron the menu Draw a single bar of symbol Print numbers from n to m Draw a rectangle Draw a right triangle : Print numbers from n tom : Draw a rectangle : Dr : Quit aw a right triangle Quit nter your choice: 7 nter your choice: nter the symbol for the rectangle: # nter the width of the rectangle: 6 nter the height of the rectangle: 3 is an invalid choice ease choose fron the nenu Draw a single bar of symbol is your rectangle: Print numbers from n to Draw a rectangle Dr aw a right triangle Quit lease choose from the nenu nter your choice: nter the symbol for the bar: nter the length of the bar: 7 : Draw a single bar of symbol : Print numbers fro n to m : Draw a rectangle is your bar Draw a right triangle Quit lease choose fron the nenu nter your choice: nter the symbol for the rectangle: ter the height of the rectangle: 5 Draw a single bar of symbol Print nunbers from n tom Draw a rectangle Draw a right triangle Quit is your triangle nter your choice: 2 nter the first bound: 7 nter the second bound: 2 : Draw a single bar of synbol Print numbers fron n to m numbers are 65432 Draw a rectangle : Draw a right triangle : Quit ter your choice:

Explanation / Answer

PROGRAM

import sys, os
# Create and implement menu function
def mainMenu():
  
print(" Please choose from the menu.")
print("============================")
print("1: Draw a single bar of symbol")
print("2: Print numbers from n to m")
print("3: Draw a rectangle")
print("4: Draw a right triangle")
print("5: Quit")
print("=============================")
choice=int(input("Enter your Choice: ")) # Read integer choice
if choice==1: # check condition for choice =1 then print bar
# read input values of symbol(sym) and length(n)
sym=input('Enter the Symbol for the bar: ')
n=int(input('Enter the length of the bar: '))
print(" Here is your bar:")
DrawBar(sym,n) # Call DrawBar() function
mainMenu() # call mainMenu()
elif choice==2: # check condition for choice=2 the print sequence
# read variables
print(" Here is the sequence:")
a=int(input("Enter the first bound: "))
b=int(input("Enter the second bound: "))
PrintSequence(a,b) # Call PrintSequence() function
mainMenu() # call mainMenu()
elif choice==3: # check condition for choice=3 the print Rectangle
sym=input("Enter the Symbol for the rectangle: ")
a=int(input("Enter the width of the rectangle: "))
b=int(input("Enter the height of the rectangle: "))
print(" Here is your rectangle:")
PrintRectangle(sym,a,b) # Call PrintRectangle() function
mainMenu() # call mainMenu()
elif choice==4: # check condition for choice=4 the print Traingle
sym=input("Enter the Symbol for the Triangle: ")
a=int(input("Enter the height of the Traingle: "))
print(" Here is your Traingle:")
PrintTriangle(sym,a) # Call PrintTraingle() function
mainMenu() # call mainMenu()
elif choice==5: # check condition for choice=5 then exit from program
exit
else:
print(choice,"Invalid choice")
mainMenu() # call mainMenu()

# Create and implement DrawBar() function
def DrawBar(symbol,length):
for i in range(length): # Create for loop until length
print(symbol,end=" ") # print symbol
  
# Create and implement PrintSequence() function
def PrintSequence(first,second):
for i in range(first,second+1): # Create for loop from first to second value
print(i,end='') # Print sequence

# Create and implement PrintRectangle() function
def PrintRectangle(symbol,width,height):
  
for i in range(height): # Create for loop until height
for j in range(width): # Create for loop until width
print(symbol,end="") # print symbol until width
print() # width is completed then new line next width symbols

# Create and implement PrintTraingle() function   

def PrintTriangle(symbol,height):
for i in range(height): # Create i loop until height
for j in range(0,i+1): # Create j loop from 0 to height value
print(symbol,end="") # print symbol
print() # print new line
  
  


if __name__ == "__main__":

mainMenu() # Call mainMenu() into main function
  

OUTPUT


Please choose from the menu.
============================
1: Draw a single bar of symbol
2: Print numbers from n to m
3: Draw a rectangle
4: Draw a right triangle
5: Quit
=============================
Enter your Choice: 7
7 Invalid choice

Please choose from the menu.
============================
1: Draw a single bar of symbol
2: Print numbers from n to m
3: Draw a rectangle
4: Draw a right triangle
5: Quit
=============================
Enter your Choice: 1
Enter the Symbol for the bar: *
Enter the length of the bar: 7


Here is your bar:
* * * * * * *
Please choose from the menu.
============================
1: Draw a single bar of symbol
2: Print numbers from n to m
3: Draw a rectangle
4: Draw a right triangle
5: Quit
=============================
Enter your Choice: 3
Enter the Symbol for the rectangle: #
Enter the width of the rectangle: 6
Enter the height of the rectangle: 3

Here is your rectangle:
######
######
######

Please choose from the menu.
============================
1: Draw a single bar of symbol
2: Print numbers from n to m
3: Draw a rectangle
4: Draw a right triangle
5: Quit
=============================
Enter your Choice: 4
Enter the Symbol for the Triangle: 8
Enter the height of the Traingle: 5

Here is your Traingle:
8
88
888
8888
88888

Please choose from the menu.
============================
1: Draw a single bar of symbol
2: Print numbers from n to m
3: Draw a rectangle
4: Draw a right triangle
5: Quit
=============================
Enter your Choice: 5

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote