Question

Write a Python program that prints a name as shown in the image below. The program asks the user to enter a name and how many
0 0
Add a comment Improve this question Transcribed image text
Answer #1

This problem asks to write a python program which asks user for three inputs prints the specified output. The code is commented nad described properly. In case if you find any difficulties let me know in comment section.

HOPE YOU LIKE THE SOLUTION!!!!

Note: Please refer code screenshot for the indentation.

Program implementation:

#Program asks for three inputs and prints the name entered by user in a matrix form.
#The dimensions of the matrix are also entered by the user.
#Your Name
#Date
print("Enter your name:",end=" ")
name=input() #stores the first input value.
print(name)
print("How amany names in a row? (1-5):",end=" ")
val1=int(input()) #stores the first integer input.
print(val1)
print("How many rows? (1-20):",end=" ")
val2=int(input()) #stores the second integer input.
print(val2)
# for loop prints the name according to the output specified.
for i in range(val2):
for j in range(val1):
print(name,end=" ")
print()

Code screenshot:

1 2 #Program asks for three inputs and prints the name entered by user in a matrix form. 3 #The dimensions of the matrix are

Output screenshot:

Output: Enter your name: Liaqat How amany names in a row? (1-5): 4 How many rows? (1-20): 7 Liaqat Liaqat Liaqat Liaqat Liaqa

Add a comment
Know the answer?
Add Answer to:
Write a Python program that prints a name as shown in the image below. The program...
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
  • 1) Write a Python program that prompts the user to enter the current month name and...

    1) Write a Python program that prompts the user to enter the current month name and prints the season for that month. Hint: If the user enters March, the output should be "Spring"; if the user enters June, the output should be "Summer". 2 )Write a Python program using the recursive/loop structure to print out an equilateral triangle below (double spacing and one space between any two adjacent asterisks in the same row).          *      * * * *...

  • C++ Write a program that asks for a number and then prints as many lines as...

    C++ Write a program that asks for a number and then prints as many lines as the user inputs. Each line contains as many pairs of characters ("*#") as the number of this line. It should look like the right half of a pyramid. Your version of the program must print the same result as the expected output. To to this lab, you must use two do-while loops. Two exceptions: When the user inputs a number less than 1, then...

  • Please use python to write the simple program. Exercise 2 - Summation Write a program to...

    Please use python to write the simple program. Exercise 2 - Summation Write a program to accept integer inputs until the user inputs a non-integer. Then, the program prints the summation of the inputted numbers. Hint: Use the function input() to get the user input. Use a variable total for calculating the summation. Need to use while loop for the repeated inputs. Use if statement with isdigit() function to check whether the user input is an integer or not. if...

  • Use PYTHON3 to create a program that asks the user for their name, and then prints...

    Use PYTHON3 to create a program that asks the user for their name, and then prints their initials. You must create a function called getInitials() that takes the name string and prints out the initials. It must be case insensitive and the initials must be printed in upper case. The program must contain a main() and a function called getInitials(), implemented as described in the function header comment given below. (You should include this function header comment in your own...

  •   Write codes that will produce the screen as shown Firstly, the program prompts user to...

      Write codes that will produce the screen as shown Firstly, the program prompts user to enter his name. Then it will display Hello <user name>. Next it prints out a menu which contains 5 options (1- add two integers, 2- add two strings, 3- compute factorial, 4- reverse a string, 5- quit program). Code all 5 tasks appropriately. When the task is completed (not including quitting program of course), the menu pops up again and asks user to try...

  • Write a PYTHON program that allows the user to navigate the lines of text in a...

    Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Write a python program that prompts the user for the names of two text files and...

    Write a python program that prompts the user for the names of two text files and compare the contents of the two files to see if they are the same. If they are, the scripts should simply output “Yes”. If they are not, the program should output “No”, followed by the first lines of each file that differ from each other. The input loop should read and compare lines from each file. The loop should break as soon as a...

  • build a phone number from digits entered by your user. Your program will loop until 10...

    build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and 9 inclusively. If so, the digit will be stored as the next number in the...

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