Question

Exercise #3: (Symbol) Write a nested loop that asks the user for symbol (store in a...

Exercise #3: (Symbol) Write a nested loop that asks the user for symbol (store in a char) and a number. The loop should output a rectangle (or square) of the character that is of the height and width of the number. E.g., if I input 4 and *, I would get:

****

****

****

****

0 0
Add a comment Improve this question Transcribed image text
Answer #1
ch = input("Enter a symbol: ")
n = int(input("Enter a number: "))

for i in range(n):
    for j in range(n):
        print(ch, end='')
    print()


Add a comment
Know the answer?
Add Answer to:
Exercise #3: (Symbol) Write a nested loop that asks the user for symbol (store in a...
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
  • Using the nested loop in C++ to finish the program //test scores. //It asks the user...

    Using the nested loop in C++ to finish the program //test scores. //It asks the user for the // number of students and //the number of test scores //per student. // Calc. and display average score // for each TEST 2 4 6 7

  • 21 Write a program that asks the user to input the length and breadth of a...

    21 Write a program that asks the user to input the length and breadth of a soccer field, and then computes and returns the number of square meters of grass required to cover the field The formula for the area is the product of length and breadth (5) 22 The following program uses the break statement to terminate an infinite while loop to print 5 numbers Rewrite the program to use a while loop to display numbers from 1 to...

  • Write a javascript that asks the user to input a number. The number is then passed into a functio...

    Im lost I need help seriously Write a javascript that asks the user to input a number. The number is then passed into a function you write that contains a loop. The loop will loop the number you passed into the function and print out the word "CSU" that many times. For instance, if l entered 3, the function would print out "CSU CSU CSU". (20 points) 5. Write a javascript that asks the user to input a number. The...

  • C++ coding answer 5. Write a program that asks the user for a positive integer value....

    C++ coding answer 5. Write a program that asks the user for a positive integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loop will find the sum of 1, 2, 3, 4, ... 50. Input Validation: Do not accept a negative starting number.

  • Write a program that asks the user to enter a string and then asks the user...

    Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming

  • I need help with Write an application that allows user to input the height and width...

    I need help with Write an application that allows user to input the height and width of a rectangle. It should output the area and perimeter of the rectangle. Use methods for entering the values, performing the computations, and displaying the results. Results should be formatted with one position to the right of the decimal and printed number aligned in a tabular display.

  • python program 6 Write an input validation loop that asks the user to enter a number...

    python program 6 Write an input validation loop that asks the user to enter a number in the range of 100 through 1000? 7 Write an input validation loop that asks the user to enter ‘Y’, ‘y’, ‘N’, or ‘n’? 8 How many times the following loop will repeat? cnt = 0    while  cnt != 5: print(cnt) cnt = cnt + 2

  • MIPS programming question Problem 1: Write a program that asks the user to input a string...

    MIPS programming question Problem 1: Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the...

  • Programming in C: Using a nested for loop create the pattern below. Prompt the user for...

    Programming in C: Using a nested for loop create the pattern below. Prompt the user for the height (number of rows) and width (number of characters per line) for pattern A. You may use any number for height and width, just as long as the basic pattern is preserved. Call a function to print the pattern. This function receives the height and width as inputs (parameters) but does not return a value. Make use of an if structure to instruct...

  • CPS180 Fall 2018 10 pts) Write a method as described below: Method name: drawRectangle Description: Parameters:...

    CPS180 Fall 2018 10 pts) Write a method as described below: Method name: drawRectangle Description: Parameters: 4 ( draws a rectangle with given border character, width, and height. A character borderChar An integer width An integer height If the method is called by Sample output: drawRectangle(', 4, 6) the output shape (rectangle with border char", width 4, height 6) should be as shown on the right

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