Task 2 [Low-quality graphics circle] This task is to help you practice nested for-loops (for-loop inside a for-loop) and if-statements. Hint: if you want to print a new line, you can print an empty string, e.g., print(""). For this task, we will draw a simple text-based circle. Recall that a circle is described as follows: x² + y² = r² Any x, y value, such that x² + y² ≤ r², will be a point inside or on the circle. With this simple information, we can draw a circle. Your task should work as follows: (1) Ask the user to input a radius from [1 to 10]. -> You can assume the input is an integer -> If the value is not between 1 and 10, keep asking radius r ² x² + y² < All x,y points x² + y² = ² Points exactly on the circle. x

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
Question
100%
Task 2 [Low-quality graphics circle]
This task is to help you practice nested for-loops (for-loop inside a for-loop) and if-statements.
Hint: if you want to print a new line, you can print an empty string, e.g., print("").
For this task, we will draw a simple text-based circle.
Recall that a circle is described as follows: x² + y² = r²
Any x, y value, such that x² + y² ≤ r², will be a point inside or on the circle.
With this simple information, we can draw a circle.
Your task should work as follows:
(1) Ask the user to input a radius from [1 to 10].
-> You can assume the input is an integer
-> If the value is not between 1 and 10, keep asking
for input [see example below]
(2) loop y from 10 to 10
loop x from 10 to 10
if the current x,y is inside or on the circle
(see equation above), then
print a '*', otherwise print a '.'
hint: consider using print (..., end="")
Examples of Task 2 (user input in red)
Task 2: Draw circle
----
Input size between 1-10: 11
Input size between 1-10: 0
Input size between 1-10: 9
***************
************
radius r
x² + y² < ²
All x,y points
inside the circle.
If the input is not between 1-10, keep
prompting the user to input a number.
x² + y² = ²
Points exactly on
the circle.
x
x² + y² > 2
All x,y points outside
the circle.
Transcribed Image Text:Task 2 [Low-quality graphics circle] This task is to help you practice nested for-loops (for-loop inside a for-loop) and if-statements. Hint: if you want to print a new line, you can print an empty string, e.g., print(""). For this task, we will draw a simple text-based circle. Recall that a circle is described as follows: x² + y² = r² Any x, y value, such that x² + y² ≤ r², will be a point inside or on the circle. With this simple information, we can draw a circle. Your task should work as follows: (1) Ask the user to input a radius from [1 to 10]. -> You can assume the input is an integer -> If the value is not between 1 and 10, keep asking for input [see example below] (2) loop y from 10 to 10 loop x from 10 to 10 if the current x,y is inside or on the circle (see equation above), then print a '*', otherwise print a '.' hint: consider using print (..., end="") Examples of Task 2 (user input in red) Task 2: Draw circle ---- Input size between 1-10: 11 Input size between 1-10: 0 Input size between 1-10: 9 *************** ************ radius r x² + y² < ² All x,y points inside the circle. If the input is not between 1-10, keep prompting the user to input a number. x² + y² = ² Points exactly on the circle. x x² + y² > 2 All x,y points outside the circle.
Expert Solution
Step 1

To print a circle pattern.

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
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
  • SEE MORE 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