Trying to figure out how to use for loops. please provide a simple python script that meets the requirements and an explanation of how it works. I've attached the desired output as an example. you will write a program that creates patterns using for-loops given the size - an odd number between 7 and 15 (both inclusive). This program Asks for size (an odd number between 7 and 15 (both inclusive)) Validates that size is an odd number between 7 and 15 (both inclusive) See the first sample run to see validation.  Prints two patterns based on the given size. Pattern 1: A pattern of <, * and > as shown below in the sample programs. This pattern has as many lines as the size of the pattern (user input) with each line having 2*size+1 characters total. Pattern 2: A pattern with mirror image made up of letter "A" (See sample runs below). Hint: Split the figure in top-half and bottom-half parts, drawing them with two different for-loops. Look at each pattern closely and come up with a formula for the number of 'A's and number of spaces required on each row in the pattern. Add a comment block at the top of the file, providing your name, date, assignment name etc. Save the program to a file with a name of the format first_last_forloops.py and submit it as your solution. Sample run 1 with validation and size = 7

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Trying to figure out how to use for loops. please provide a simple python script that meets the requirements and an explanation of how it works. I've attached the desired output as an example.

you will write a program that creates patterns using for-loops given the size - an odd number between 7 and 15 (both inclusive).

This program

  • Asks for size (an odd number between 7 and 15 (both inclusive))
  • Validates that size is an odd number between 7 and 15 (both inclusive) See the first sample run to see validation. 
  • Prints two patterns based on the given size.
    • Pattern 1: A pattern of <, * and > as shown below in the sample programs. This pattern has as many lines as the size of the pattern (user input) with each line having 2*size+1 characters total.
    • Pattern 2: A pattern with mirror image made up of letter "A" (See sample runs below). Hint: Split the figure in top-half and bottom-half parts, drawing them with two different for-loops. Look at each pattern closely and come up with a formula for the number of 'A's and number of spaces required on each row in the pattern.

Add a comment block at the top of the file, providing your name, date, assignment name etc. Save the program to a file with a name of the format first_last_forloops.py and submit it as your solution.

Sample run 1 with validation and size = 7

Python 3.8.1 Shell
File Edit Shell Debug Options Window Help
y
Welcome to pattern generator
Please enter the size of the patterns (an odd number between 7 and 15): -3
Size should be an odd number between 7 and 15
Please enter the size of the patterns (an odd number between 7 and 15): 8
Size should be an odd number between 7 and 15
Please enter the size of the patterns (an odd number between 7 and 15): 7
Pattern 1 of size 7
«««<<*>
<«<<<<***>>
<<<<<*
***
«<*
<<**
<***
****>
Mirror image pattern of size 7
A
A
AA
AA
AAA
AAA
AAAA
AAAAA
AAAA
AAAAA
AAAAAA
AAAAAA
AAAAAAAAAAAAAA
AAAAAA AAAAAA
AAAAA
AAAAA
AAAA
AAAA
AAA
AAA
AA
AA
A
A
Bye
>> |
Transcribed Image Text:Python 3.8.1 Shell File Edit Shell Debug Options Window Help y Welcome to pattern generator Please enter the size of the patterns (an odd number between 7 and 15): -3 Size should be an odd number between 7 and 15 Please enter the size of the patterns (an odd number between 7 and 15): 8 Size should be an odd number between 7 and 15 Please enter the size of the patterns (an odd number between 7 and 15): 7 Pattern 1 of size 7 «««<<*> <«<<<<***>> <<<<<* *** «<* <<** <*** ****> Mirror image pattern of size 7 A A AA AA AAA AAA AAAA AAAAA AAAA AAAAA AAAAAA AAAAAA AAAAAAAAAAAAAA AAAAAA AAAAAA AAAAA AAAAA AAAA AAAA AAA AAA AA AA A A Bye >> |
Python 3.8.1 Shell
Eile Edit Shell Debug Options Window Help
Please enter the size of the patterns (an odd number between 7 and 15): 9
Pattern 1 of size 9
<<<<<<<<<*>>
<<<<<<<<**
<<<<<
<<<
<<*
*******>
Mirror image pattern of size 9
A
A
AA
AA
AAA
AAA
AAAA
AAAAA
AAAA
AAAAA
AAAAAA
AAAAAA
AAAAAAA
AAAAAAA
AAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAAAAA
AAAAAAAA AAAAAAAA
AAAAAAA
AAAAAAA
AAAAAA
AAAAAA
AAAAA
AAAAA
AAAA
AAAA
AAA
AAA
AA
AA
A
A
Bye
>>>
Transcribed Image Text:Python 3.8.1 Shell Eile Edit Shell Debug Options Window Help Please enter the size of the patterns (an odd number between 7 and 15): 9 Pattern 1 of size 9 <<<<<<<<<*>> <<<<<<<<** <<<<< <<< <<* *******> Mirror image pattern of size 9 A A AA AA AAA AAA AAAA AAAAA AAAA AAAAA AAAAAA AAAAAA AAAAAAA AAAAAAA AAAAAAAA AAAAAAAA AAAAAAAAAAAAAAAAAA AAAAAAAA AAAAAAAA AAAAAAA AAAAAAA AAAAAA AAAAAA AAAAA AAAAA AAAA AAAA AAA AAA AA AA A A Bye >>>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education