0% found this document useful (0 votes)
9 views4 pages

100 Python Practice Questions

Uploaded by

imran immu
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)
9 views4 pages

100 Python Practice Questions

Uploaded by

imran immu
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
You are on page 1/ 4

100 Python Practice Questions

Basics & Variables (110)

Create a variable `name` and assign your name to it.


Print the value of two variables `a = 10` and `b = 20` on the same line.
What is the output of: `x = 5; print(type(x))`?
Assign 3 different values in one line to three variables.
Swap values of two variables.
Write a program to take a number as input and print it.
Convert the string "25" into an integer and add 10.
What will be the output of `print(5 / 2)` vs `print(5 // 2)`?
What does `type()` function return?
How to assign a multi-line string to a variable?

Strings (1120)

Create a string and print its first and last character.


Find the length of a string using `len()`.
Concatenate two strings and print.
Convert a string to uppercase.
Replace all spaces with underscores in a string.
Write a program to count vowels in a string.
Check if a string starts with a specific word.
Reverse a string using slicing.
Extract only numbers from a string like "abc123xyz".
Format a string using f-strings.

Numbers & Operators (2130)

Write a program to check if a number is even or odd.


Calculate the square and cube of a number.
Write a simple interest calculator.
Convert Celsius to Fahrenheit.
Check if a number is divisible by 5 and 11.
Find the largest of three numbers.
Print the multiplication table of any number.
Write a program to calculate factorial using a loop.
Write a program to find all prime numbers from 1 to 100.
Check if a number is a palindrome.

Conditional Statements (3140)

Write a program to check if a person is eligible to vote.


Create a login system with predefined username and password.
Write a program to classify age groups (child, adult, senior).
Check if a number is positive, negative or zero.
Use `if-elif-else` to calculate grade from marks.
Check if a year is a leap year.
Create a simple calculator using `if` conditions.
Check if a character is a vowel or consonant.
Write a program to compare two strings.
Check whether a number is even and divisible by 3.

Loops (4150)

Print numbers from 1 to 10 using a loop.


Print the sum of first N natural numbers.
Print only even numbers from a list.
Print each character of a string using `for` loop.
Find the factorial of a number using `while` loop.
Use `break` to stop a loop at a specific number.
Use `continue` to skip printing number 5.
Write a program to count digits in a number.
Print a triangle pattern using `*`.
Reverse a number using loops.

Lists & Tuples (5160)

Create a list of 5 numbers and print it.


Append a number to the list.
Remove an element from the list by value.
Sort a list in ascending and descending order.
Find the largest number in a list using `max()`.
Count occurrences of an element in a list.
Convert a list to a tuple.
Slice and print the last 3 elements of a list.
Create a list from 1 to 100 using `range()`.
Merge two lists.

Dictionaries & Sets (6170)

Create a dictionary with name, age and city.


Add a new key-value pair to a dictionary.
Delete a key from a dictionary.
Loop through a dictionary and print keys and values.
Find whether a key exists in a dictionary.
Create a set and add elements to it.
Remove duplicates from a list using set.
Find the union of two sets.
Check if a set is a subset of another.
Remove an element safely using `discard()`.

Functions (7185)

Write a function to add two numbers.


Create a function that returns the square of a number.
Write a function to find the largest of three numbers.
Create a function with default arguments.
Create a function that prints a table of a number.
Return True if a number is prime.
Create a function that accepts `*args` and returns their sum.
Create a function that accepts `**kwargs` and prints key-value pairs.
Create a lambda function to double a number.
Use `map()` to square a list of numbers.
Use `filter()` to extract even numbers from a list.
Use `reduce()` to multiply all numbers in a list.
Create a function to reverse a string.
Write a function that checks if a string is a palindrome.
Create a function that counts vowels in a string.

Real-Life Mini Projects (86100)


Create a contact book (store name + number).
Create a password strength checker.
Build a grade calculator using functions.
Create a shopping cart using a dictionary.
Create a BMI calculator.
Build a basic calculator using functions.
Create an expense tracker using a list.
Create a login authenticator system.
Generate invoices using `**kwargs`.
Make a to-do task manager using a list.
Create a student report card generator.
Create a function that returns current time and date.
Build a quiz game (MCQ style).
Create a temperature converter (CFK).
Create a menu-based CLI tool (like ATM or billing app).

You might also like