0% found this document useful (0 votes)
12 views

python practice questions

Uploaded by

maulikdedunmmm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

python practice questions

Uploaded by

maulikdedunmmm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Conditions: [if elif else]

1. Write a program determining whether a given number is positive, negative, or zero.


2. Create a function that accepts a list of numbers and returns a list containing only the
positive numbers.
3. Write a program to determine whether a given character is a vowel or a consonant.
4. Create a function that checks if a given number is within a specified range (inclusive).
5. Write a program to determine a student's grade based on their marks (e.g., A for
90-100, B for 80-89, etc.).
6. Create a function that accepts a temperature in Celsius and returns a description
(e.g., "cold" for below 10°C, "warm" for 10-25°C, "hot" for above 25°C).

Looping: [for/while loop]

1. Write a Python program to print all numbers between 1 and 50 that are divisible by 3.
2. Create a function that takes a list of numbers as input and returns the sum of all even
numbers in the list.
3. Write a program to calculate the factorial of a number using a while loop.

Functions: [functions and parameters]

1. Write a function that checks if a number is prime.


2. Create a function that takes a string as input and returns the string reversed.
3. Define a function that accepts a list of integers and returns the average.

You might also like