Ask Question
Today, 19:31

write a program that takes an input from a user for the number of rows and number of columns and prints out a block of characters that is based on these 2 parameters. The program should keep asking the user for input, and printing out the result, until the user enters zero for either of the input parameters.

+2
Answers (1)
  1. Today, 21:34
    0
    while True:

    rows = int (input ("Enter number of rows: "))

    columns = int (input ("Enter number of columns: "))

    if rows = = 0 or columns = = 0:

    break

    else:

    for _ in range (rows):

    for _ in range (columns):

    print ("*", end=" ")

    print (" ")

    Explanation:

    Create a while loop

    Ask the user for the number of rows and columns

    Check if rows or columns are equal to zero. If at least one of them is zero, stop the loop.

    Otherwise, create a nested for loop that iterates according to the rows and columns and prints "*" blocks
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “write a program that takes an input from a user for the number of rows and number of columns and prints out a block of characters that is ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers