Python Exercises



1) Write a Python program to test whether a number is within 100 of 1000 or 2000

2) Write a Python program to find whether a given number is even or odd

3) Write a Python program to count the number 4 in a given list Ex: list = [4,5,4,10,4,13,4,8,11,4], Answer is 5

4) Write a Python program to find whether a given number is Prime (Numbers such as 2,3,5,7,11,13...) 

5) 
Write a Python program to accept a filename from the user and print the extension of that. 

6) 
Write a Python program to display the first and last colors from the following list.

7) 
Write a Python program to calculate number of days between two dates.

8) Write a Python program to accept a filename from the user and print the extension of that. 
Sample filename : abc.java
Output : java

9) Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. 
Sample value of n is 5
Expected Result : 615

10) Write a Python program to test whether a number is within 100 of 1000 or 2000

11) Write a Python program to test whether a given letter is a vowel or not

12) Print the following pattern using Python loop

*
**
***
****
*****
******
*******
********
*********
**********
 

13) How to get factorial of a number?


Collection by Shashank in association with ITTC

ITTC