Sample Practice Questions

Challenge yourself with these Python problems!

Sr No. Question Topic Level Answer
1 What is the output of print(2 + 3 * 4)?
Arithmetic
Easy
πŸ“‚
2 Which of the following is a valid variable name in Python?
Variables
Medium
πŸ“‚
3 What is the correct syntax to define a function in Python?
Functions
Hard
πŸ“‚
4 Take 2 float inputs and print their average
Input/Output
Easy
πŸ“‚
5 Take 2 inputs a and b, if a β‰₯ b print true else print false
Conditional
Easy
πŸ“‚
6 W.A.P for special character of length (C/W)
Strings
Medium
πŸ“‚
7 Python Pattern Printer Version 1.1
Patterns
Medium
πŸ“‚
8 Take 10 names input, then print the alternative names. Now, take two more names in the original list and remove the 5th and 7th element from the original list (C/W)
Lists
Medium
πŸ“‚
9 Write a program for Palindrome.
Strings
Medium
πŸ“‚
10 W.A.P Program using dictionary to count the frequency of each character in a string
Dictionaries
Medium
πŸ“‚
11 Write a program in python to input a sentence and display the words individually and count the no. of vowels and display them.
Strings
Medium
πŸ“‚
12 W.A.P. to input a list of numbers and display sum of even and odd numbers separately.
Lists
Medium
πŸ“‚
13 W.A.P. to Print the second largest no from a list
Lists
Medium
πŸ“‚
14 To print a simple Fibonacci series (Fibonacci Series: the number next in series is the sum of the number and the previous no, Ex: 0 1 2 3 5 8 ….)
Numbers
Medium
πŸ“‚
15 Simple program to find the factorial of a number
Numbers
Easy
πŸ“‚
16 To check if given Number is a Armstrong Number or not (Armstrong no: the sum of individual digits raised the the power of no of digits is same as the original number, Fun fact it is also called a narcissistic number)
Numbers
Medium
πŸ“‚
17 Simple program to find a required element from a list
Lists
Easy
πŸ“‚
18 To make a 2D 3 x 3 list and find the diagonal sum
Lists
Medium
πŸ“‚
19 To create a list and find the duplicate elements in it and print in with the frequency of repetition
Lists
Medium
πŸ“‚
20 Program to find Perfect numbers between 1 and 1000 (Perfect no: A number who’s sum of the factorials excluding itself is equal to the number)
Numbers
Hard
πŸ“‚
21 Create a 3 X 3 Matrix and print the odd no.
Lists
Medium
πŸ“‚
22 Pattern Program for 1 2 3 4 5
2 4
3 3
4 2
5 4 3 2 1
Patterns
Medium
πŸ“‚
23 β€˜random()’ function example
Functions
Easy
πŸ“‚
24 Create a list of size 10 for float value print Whole no from the list Then find the sum
Lists
Easy
πŸ“‚
25 Create a dictionary for name, marks and roll of n no. of students and display the names of the students with marks <80
Dictionaries
Medium
πŸ“‚
26 Input 10 no. is a single dimension list then distribute it into 2x5 matrix and print it find the highest element from the matrix
Lists
Medium
πŸ“‚
27 Input a string and remove the spaces from it and print it count no. of articles a an and the
Strings
Easy
πŸ“‚
28 WAP to input a paragraph and print lines ending with β€œ.” and β€œ!”
Strings
Medium
πŸ“‚
29 WAP to check if input is a palindrome or not
Strings
Easy
πŸ“‚
30 Enter 5 country names and their country code and save them in a dictionary with their respective information.
Dictionaries
Medium
πŸ“‚
31 Take two list of length 5 each then print the common elements of the list and replace the common elements of the list with spaces β€˜ ’
Lists
Medium
πŸ“‚
32 a
CC
eee
GGGG
Patterns
Medium
πŸ“‚
33 Decimal to binary conversion
Numbers
Medium
πŸ“‚
34 1 2 3
8 9 4
7 6 5 spiral matrix
Patterns
Hard
πŸ“‚
35 Menu driven Program (PYQ)
Functions
Medium
πŸ“‚
36 Input a string and print each word in a separate line, then separately print words with more than 5 characters
Strings
Easy
πŸ“‚
37 Hailstone series
Numbers
Medium
πŸ“‚
38 Write a program to count the number of times a character appears in a given string.
Strings
Easy
πŸ“‚