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
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
![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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fdac761a6-ba1c-4b50-93cd-f82ea0746880%2F038ba81a-094a-4264-a94a-97e1b59ad75d%2Fvb06iyd_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
To print a circle pattern.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)