This document contains a list of 57 practical programming questions covering various Python concepts like string manipulation, conditional statements, loops, functions, modules, OOP concepts, exception handling, file handling etc. The questions get progressively complex testing different programming constructs.
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 ratings0% found this document useful (0 votes)
46 views3 pages
PWP QB PR
This document contains a list of 57 practical programming questions covering various Python concepts like string manipulation, conditional statements, loops, functions, modules, OOP concepts, exception handling, file handling etc. The questions get progressively complex testing different programming constructs.
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/ 3
PWP practical question bank
Sr. no. Question
1 Input user's name and display "Hello <username>" 2 Concatenate two strings 3 Write a program to convert USD to INR where 1 USD = 75 INR 4 Write a program to calculate square root of a number. 5 Write a program to calculate square root of a number using math module 6 Write a program to find greatest of three numbers 7 Write a program to find out if entered year is a leap year or not 8 Write a program to find out if enetered number is even or odd 9 Write a program to make use of conditional operator in Python 10 Write a program to calculate area of triangle, square and rectangle. 11 Write a program to calculate square and cube of a number 12 Ask user to enter a number and display if the number is positive, negative or zero. 13 Ask user to enter a number and display if it is a prme number or not. Ask user to enter their marks of 5 subjects, display average score & percentage with 14 their grade. Maximum marks per subject are 70. 15 Write a program to reverse a list without using built in functions. Create a list of numbers and display every prime number from the list. If there are no 16 prime numbers in the list, display "No prime numbers found" Write a program to ask user for a number (n) and then create a list of random 17 integers with n elements. Hint: use random module. 18 Write a program to print the table (upto 20) of any number that user enters. Write a program to print the following pattern: * *** 19 ***** *** * Write a program to print the following pattern: * 20 *** ***** Write a program to print the following pattern: ***** 21 *** * Write a program to print the following pattern: * 22 ** *** **** Write a program to print the following pattern: 1 23 12 123 1234 Write a program to print the following pattern: 1 22 24 333 4444 55555 25 Write a program with a function to reverse the given number. 26 Write a program to print reverse of a number but do not use any loops. 27 Write a program to print the sum of digits of an entered number. 28 Write a program to print the product of digits of an entered number. 29 Write a program to check if the entered number is a palindrome or not. Write a program with a function which returns True if the entered number is a 30 palindrome. 31 Write a program to deteremine if an entered number is an armstrong number or not. 32 Write a program to add, subtract, multiply and divide matrices. 33 Write a program to find the largest number from a list. 34 Write a program to sort a list in descending order. 35 Write a program to perform set operatons. 36 Ask user for details like name, age, date of birth and save it in a dictionary. Write a program to input a tuple of n items from the user and display the sum of all 37 digits of the tuple. Print the entered number in words. 38 For example: 1234 => One Two Three Four Ask user to enter a string. Count the number of upper case, lower case letters and 39 digits in the string and display the data. Ask user to enter a password. Check the password for atleast: 1. 1 lower case alphabet 40 2. 1 upper case alphabet 3. 1 special character 4. Atleast 8 characters long 41 Ask user for a number and calculate its factorial using a function. Write a Python module containing basic math functions such as: 1. average of numbers 2. add n numbers 42 3. square of number 4. cube of number 5. factorial of number Import the module in another file and demonstrate use of all functions. 43 Write a program to print the calendar of year 2020 Write a program to print calendar of the month user wants. Ask user to enter the 44 month and year. Write a program to overload a function named as 'greet'. It must accept at most 2 and 45 at least no parameters. 2 parameters namely: user's name, message to print. Write a program with an overloaded function area() which can be used to calculate 46 area of square and rectangle. Write a program with an overloaded function volume() which can be used to calculate area of cube, cuboid and cylinder. Hint: 47 volume of cube = (side)^3 volume of cuboid = length * breadth * width volume of cylinder = PI*(radius)^2*height Write a program to create a class Person with basic attributes such as name, age and 48 address. Create another class Employee which is derived from Person and store information like designation, company_name, salary. Display all the information. 49 Write a program to implement composition relation. Write a Python program to create a class 'Degree' having a method 'getDegree' that prints "I got a degree". It has two subclasses namely 'Undergraduate' and 50 'Postgraduate' each having a method with the same name that prints "I am an Undergraduate" and "I am a Postgraduate" respectively. Call the method by creating an object of each of the three classes. Ask user to enter a password. If the password is not 8 characters long, throw 51 BadPasswordError. Note: Create user defined exception BadPasswordError. Write a program to ask user for a number to check if it is prime or not. If user enters 52 an alphabet or special character instead of the number, display "only numbers are allowed" 53 Write a program to print Fibonacci series of n elements. Ask user to enter value of n. 54 Write a program with a function which returns a list of fibonacci elements. 55 Write a program to write data into a file. Take the data from user 56 Write a program to copy contents of one file. Write a program to print the number of digits in the file. 57 For example, if the file's contents are: "1 sheep and 2 cows were sold," the output would be 2.