Ask Question
24 January, 22:55

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.

+1
Answers (1)
  1. 25 January, 02:35
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers