Question

Write a program in Python that will: Here are following requirements to completing Menu shapes: 1....

Write a program in Python that will: Here are following requirements to completing Menu shapes:

1. Create a "MENU" with 4 - 5 options have the user click the option and thereafter ask the user to enter the amount of stars from 1 - 50. From there your "for loop" will create the shape.

Menu options need to be:

1. Filled Triangle

2. filled Square

3. This can be any shape such as a Square, circle, a different angle of the triangle...etc

4 . Bow Tie shape with a circle in the middle

5. Exit

I will need the following requirements:

a. case statements for each menu option 1,2,3,4,(5)

b. either do/while, while loop, or for loop

c. each shape should have it own function

d. if/else statement or try/catch statements for error message.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

IF YOU HAVE ANY DOUBTS COMMENT BELOW

ANSWER:

CODE:

def drawTraingle(size):
for i in range(size):
for j in range(i+1):
print("*",end="")
print()
  
def drawSquare(size):
for i in range(size):
for j in range(size):
print("*",end=" ")
print()
  
def drawRect(size):
for i in range(int(size/2)):
for j in range(size):
print("*",end=" ")
print()
  

def drawBowTie(size):
for i in range(size+1):
for j in range(size):
if i <=size/2:
if i>=j or j>=size-i-1:
print("*",end=" ")
else:
print(" ",end="")
else:
if j<=size-i or j>=i-1:
print("*",end=" ")
else:
print(" ",end="")
print()
  
if __name__ == '__main__':
while True:
print("Please select an option")
print("1. Filled Triangle")
print("2. filled Square")
print("3. Draw rectangle")
print("4. Bow Tie shape")
print("5. Exit")
choice = int(input("Enter your choice : "))
if(choice==5) : break
else:
size = int(input("Enter the size"))
if(choice==1) : drawTraingle(size);
if(choice==2) : drawSquare(size);
if(choice==3) : drawRect(size);
if(choice==4) : drawBowTie(size);
print("\n")

Add a comment
Know the answer?
Add Answer to:
Write a program in Python that will: Here are following requirements to completing Menu shapes: 1....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...

    Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...

  • Write a C program that does the following: • Displays a menu (similar to what you...

    Write a C program that does the following: • Displays a menu (similar to what you see in a Bank ATM machine) that prompts the user to enter a single character S or D or Q and then prints a shape of Square, Diamond (with selected height and selected symbol), or Quits if user entered Q. Apart from these 2 other shapes, add a new shape of your choice for any related character. • Program then prompts the user to...

  • Geometric calclator use python to do this program. Write a program that displays the following menu:...

    Geometric calclator use python to do this program. Write a program that displays the following menu: 1. Calculate the area of circle 2. calculate the area of rectangle 3. calculate the area of triangle 4. Quit Enter your choice (1-4). if the user enters 1, your program should ask for the radius of the circle and then display its area. Use the formula to calculate the circle's area: Area = pi*r^2 Use 3.14149 for Pi and the radius of the...

  • Write a Java program that prompts user to select one of the five shapes(Rectangle, Square, Triangle,...

    Write a Java program that prompts user to select one of the five shapes(Rectangle, Square, Triangle, Circle, and Parallelogram), then calculate area of the shape,must have input validation and uses more of java library like math class, wrapper class, string methods, use formatted output with the printf method. Finally, create a pseudo-code statement and flowchart

  • For this lab you will write a small program that prints a few "shapes" using asterisks....

    For this lab you will write a small program that prints a few "shapes" using asterisks. Your program will prompt the user to select a shape by entering a number (square or triangle for B grade, add the zig- zag for the A grade). It will then prompt for the size, and then if a square or triangle is selected it will prompt for "not filled" or "filled", and if azig-zag is selected it will prompt for the number of...

  • Using Python Write the following well-documented (commented) program. Create a class called Shape that has a...

    Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....

  • Create a python program based on the following requirements the program should also have to have...

    Create a python program based on the following requirements the program should also have to have the following Base Class - Car (Make, Model, year) Sub Class - Gas (Make, Model, year, and gas per mile) Sub Class - Electric (Make, Model, year, and Full Battery charged per mile) 1. Add car 2. View car 3. Delete car 4. Exit program 1. The Car sell manager Application will need to store the car information for gas-powered car members and electric-powered...

  • (PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator...

    (PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1 - 4): If the user enters 1, the program should ask for the radius of the circle and then display its area. If the user enters 2, the program should ask for the length and width of...

  • Write a program that stores the following data in a tuple: 54,76,32,14,29,12,64,97,50,86,43,12 The program needs to...

    Write a program that stores the following data in a tuple: 54,76,32,14,29,12,64,97,50,86,43,12 The program needs to display a menu to the user, with the following 4 options: 1 – Display minimum 2 – Display maximum 3 – Display total 4 – Display average 5 – Quit Make your program loop back to this menu until the user chooses option 5. Write code for all 4 other menu choices using the python code and screenshot the python code for me. many...

  • Q2: Write a menu-driven C program using switch-case to calculate the following: 1. Area of circle...

    Q2: Write a menu-driven C program using switch-case to calculate the following: 1. Area of circle 2. Area of square 3. Area of rectangle The program should use the following functions properly: void displayMenu() //a function that will display the menu options to the user int getChoice() //a function that will input the user choice and returns it float calculate(int choice) //a function that reads the required inputs based on the user choice, and returns the area of the shape...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT