Python Practice Question For The M1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Python Practice Question (PPQ)

{Topics covered :-variables, input,if else, elif ,for loop,while


loop,List, tuple,set,string and dictionary}
1 Create the multiple variables with single value and vice versa?
2 Take a input from user in input ask his/her name ,age ,contact number and
print the all information
3 Write code to get three numbers and add first 2 number and multiply with
third number
4 Take two numbers as input from the user and print their product.
5 Write a program that checks if a number is positive, negative, or zero.
6 Write a program to check if a number is even or odd.
7 print numbers from 1 to 10 using a for loop
8 Create a list of fruits and print each fruit using a for loop and use while loop
also.
9 Write a Python program that takes a list of numbers and for each
number in the list, it prints "FUN" if the number is divisible by 5, "FLIP"
if divisible by 10, "FUNFLIP" if divisible by both, and the number itself if
divisible by neither.
numbers = [1, 3, 5, 15, 7, 9, 10, 30, 22]

10 Write a program that keeps asking the user for input until they enter 'exit'.
11 Create a list of integers and print the sum of all elements.
12 Add an element to a list and print the updated list
13 Access and print the second element of a tuple.
14 Create a set of unique numbers and print it
OR
Add an element to a set and print the updated set.
15 Reverse a string and print it
OR
count the number of vowels in a string.
16 Create a dictionary with three key-value pairs and print it.
OR
Access and print the value associated with a specific key in a dictionary
17 Remove an element from a list and print the updated list.
Sort a list of numbers in ascending order.
18 Write a Python program that calculates the factorial of a number using
a for loop
19 reate a simple calculator that performs addition, subtraction, multiplication,
or division based on user input.
20 Find the maximum and minimum values in a list.
OR
Create a list of squares of numbers from 1 to 10.
21 Create a program that generates Fibonacci numbers up to n using loops.
22 Calculate the area of a rectangle given its length and width via user input.
23 Write a program that checks if a year is a leap year.
24 Write a program that assigns grades based on scores (A, B, C, D, F).
25 Create a variable `x`, assign it your favorite number, and print it.
OR
Swap the values of two variables and print them.

You might also like