Exercise
Quadrilateral V2
Objective
Develop a Python program that prompts the user for a number, width, and height, and displays a rectangle of that width and height using that number for the inner symbol, as shown in the example below:
Enter a number: 4
Enter the desired width: 3
Enter the desired height: 5
444
444
444
444
444
Example Python Exercise
Show Python Code
# Prompt the user to enter a number
num = input("Enter a number: ")
# Prompt the user to enter the desired width
width = int(input("Enter the desired width: "))
# Prompt the user to enter the desired height
height = int(input("Enter the desired height: "))
# Use a while loop to display the rectangle
i = 0
while i < height:
print(num * width)
i += 1
Output
Enter a number: 4
Enter the desired width: 3
Enter the desired height: 5
444
444
444
444
444
Share this Python Exercise