0% found this document useful (0 votes)
231 views

Python Basic (Part - I) (150 Exercises With Solution)

This document contains a Python basic tutorial with 150 exercises and solutions. It introduces Python programs to format and print a poem, get the Python version, display the current date and time, calculate the area of a circle from user input radius, print a user's first and last name in reverse order, and generate a list and tuple from user-input comma separated numbers. The exercises are accompanied by an online code editor to write and test Python scripts.

Uploaded by

Garnik Pepelyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views

Python Basic (Part - I) (150 Exercises With Solution)

This document contains a Python basic tutorial with 150 exercises and solutions. It introduces Python programs to format and print a poem, get the Python version, display the current date and time, calculate the area of a circle from user input radius, print a user's first and last name in reverse order, and generate a list and tuple from user-input comma separated numbers. The exercises are accompanied by an online code editor to write and test Python scripts.

Uploaded by

Garnik Pepelyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Basic (Part -I) -

Exercises, Practice, Solution


Last update on June 27 2020 08:54:40 (UTC/GMT +8 hours)

Python basic (Part -I) [150 exercises with

solution]
[An editor is available at the bottom of the page to write and
execute the scripts.]

1. Write a Python program to print the following string in a


specific format (see the output). Go to the editor
Sample String : "Twinkle, twinkle, little star, How I wonder
what you are! Up above the world so high, Like a diamond in
the sky. Twinkle, twinkle, little star, How I wonder what you
are" Output :
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
Twinkle, twinkle, little star,
How I wonder what you are

Click me to see the sample solution

2. Write a Python program to get the Python version you are


using. Go to the editor
Click me to see the sample solution
3. Write a Python program to display the current date and
time.
Sample Output :
Current date and time :
2014-07-05 14:34:14
Click me to see the sample solution

4. Write a Python program which accepts the radius of a circle


from the user and compute the area. Go to the editor
Sample Output :
r = 1.1
Area = 3.8013271108436504
Click me to see the sample solution

5. Write a Python program which accepts the user's first and


last name and print them in reverse order with a space
between them. Go to the editor
Click me to see the sample solution

6. Write a Python program which accepts a sequence of


comma-separated numbers from user and generate a list and
a tuple with those numbers. Go to the editor
Sample data : 3, 5, 7, 23
Output :
List : ['3', ' 5', ' 7', ' 23']
Tuple : ('3', ' 5', ' 7', ' 23')
Click me to see the sample solution

You might also like