0% found this document useful (0 votes)
20 views2 pages

Python Programming Exercises

The document contains a list of 20 Python programming tasks, including getting the Python version, displaying the current date and time, calculating the area of a circle, and solving a mathematical expression. It also includes tasks for working with lists, dictionaries, functions, and recursion. Each task is a practical exercise aimed at enhancing Python programming skills.

Uploaded by

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

Python Programming Exercises

The document contains a list of 20 Python programming tasks, including getting the Python version, displaying the current date and time, calculating the area of a circle, and solving a mathematical expression. It also includes tasks for working with lists, dictionaries, functions, and recursion. Each task is a practical exercise aimed at enhancing Python programming skills.

Uploaded by

rahulmmmut
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1)Write a Python program to get the Python version you are using

2)Write a Python program to display the current date and time

3) Write a Python program which accepts the radius of a circle from


the user and compute the area.

4)Solve the expression. 5.2 + True + bool(-5) - 4 + 42//5 +bool(0) +


False + int(5.9) + float('1')

5)Write code to test whether the given number lies between 1 and 10

6)sum the numbers from 1 to 20 using for loop

7)Display the numbers in reverse from 100 to 1

8)Display multiples of 2 from 10 to 50 using range

9)From the below nested dictionary, pick the word "Bangalore".


d = {'1':'One','2':[1,{'Two':['Ch','Cbe','Salem',{'Place':
[5,6,7,'Bangalore']}]}]}

10)Use functions to return square of numbers from 2 to 5

11)Write a Python program which accepts a sequence of comma-separated


numbers from user and generate a list and a
tuple with those numbers

12) Write a Python program to display the first and last colors from
the following list.
color_list = ["Red","Green","White" ,"Black"]

13)Write a Python program to calculate number of days between two


dates.
Sample dates : (2014, 7, 2), (2014, 7, 11)

14)Write a Python program to get the difference between a given number


and 17,
if the number is greater than 17 return double the absolute difference

15)To check whather given element exists in list or not??


list=[1,2,3,4,5,6,7,8,9,10]
check if 9 and 12 are present in given list or not

16)Write a function calculation() such that it can accept two


variables and calculate the addition and subtraction of it.
And also it must return both addition and subtraction in a single
return call

17)Create a function showEmployee() in such a way that it should


accept employee name, and it’s salary and display both,
and if the salary is missing in function call it should show it as
9000
18) Write a recursive function to calculate the sum of numbers from 0
to 10

19)Generate a Python list of all the even numbers between 4 to 30

20)Return the largest item from the given list

You might also like