Exercises_Questions
Exercises_Questions
Exercises
1. Write a program to draw a pattern like this.
Hint: Learn how you can print a line without inserting a newline.
2. Write a program to add numbers between 1 and N where N is defined by the user input.
Hint: Search the documentation for range
(https://docs.python.org/3/library/stdtypes.html#typesseq)
Hint: The formula for finding the sum of the measure of the interior angles is (n - 2) * 180.
To find the measure of one interior angle, we take that formula and divide by the number of
sides n: (n - 2) * 180 / n
4. Draw the art in following figure using turtle. You can use turtle.circle() function to draw
circles.
Hint: There are 30 circles in the figure
5. Create a random list of size N with integer random numbers in the rang 0-9 . N should be an
input given by the user.
Display the random number list and the same list in reverse order.
Hint: Have a quick look at the Python random module
(https://docs.python.org/3/library/random.html)
Also read following documentation on Python lists. You don’t have to read all the details. In this case
find out how you can append elements and reverse the elements of a list in place.
https://docs.python.org/3/tutorial/datastructures.html
6. Input N integers from user and store them in a List. Display the list and the average of those
N numbers.
8. Write a function which returns the value of the following function for a given x value.
9. Write a program that asks the age of the user and displays his/her age category accordingly.