Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WRITE A PYTHON CODE Write a program that prompts and takes an input from a user with values ranging from 4 to 10 and that
WRITE A PYTHON CODE
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 12 123 123 12345 12345 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 andprompt 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)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started