Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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.
expand button
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
Check Mark
Step 1

To print a circle pattern.

Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education