Write a program that prompts and takes an input from a user with values ranging from 4 to 10 and that prints the following pattern(s): 1 123 12345 123 1 If the user enters an odd number such as '5' the pattern above will be printed to the console. However, if the user enters an even number such as '4' or '6', then the following patterns will be printed instead:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Python programing

Question-Diamond pattern

Write a program that prompts and takes an input from a user with values ranging from 4 to 10
and that prints the following pattern(s):
1
123
12345
123
1
If the user enters an odd number such as '5' the pattern above will be printed to the console. However,
if the user enters an even number such as 4' or '6', then the following patterns will be printed instead:
Transcribed Image Text:Write a program that prompts and takes an input from a user with values ranging from 4 to 10 and that prints the following pattern(s): 1 123 12345 123 1 If the user enters an odd number such as '5' the pattern above will be printed to the console. However, if the user enters an even number such as 4' or '6', then the following patterns will be printed instead:
1
1
123
123
12345
12345
123
123
1
1
When the number is even, the middle row will be repeated and for odd numbers the middle line is only
shown once (as seen in the first screen shot above). Ensure your program has the correct algorithm and
is not simply printing several different patterns statically, else you will not receive any marks!
In general your program should behave like the following:
1. Display a welcome message and prompt the user for the input value. The input value should be
greater than 4 and less than 10. Keep prompting the user until the input value is valid.
2. Display the pattern and ask the user if they want to continue with the program.
3. As long as the user wants to display another pattern your program repeats steps 1-2
4. Display a closing message if the user decides to quit (create an option to quit)
Transcribed Image Text:1 1 123 123 12345 12345 123 123 1 1 When the number is even, the middle row will be repeated and for odd numbers the middle line is only shown once (as seen in the first screen shot above). Ensure your program has the correct algorithm and is not simply printing several different patterns statically, else you will not receive any marks! In general your program should behave like the following: 1. Display a welcome message and prompt the user for the input value. The input value should be greater than 4 and less than 10. Keep prompting the user until the input value is valid. 2. Display the pattern and ask the user if they want to continue with the program. 3. As long as the user wants to display another pattern your program repeats steps 1-2 4. Display a closing message if the user decides to quit (create an option to quit)
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY