The document outlines a series of Python programming exercises for MCA 3rd semester students, focusing on control structures like if-else, while, and for loops. It includes tasks such as character checks, electricity bill calculations, number reversals, palindrome checks, and generating sequences. The exercises aim to enhance programming skills through practical applications of basic concepts.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views
Lab Exercise2 Questions
The document outlines a series of Python programming exercises for MCA 3rd semester students, focusing on control structures like if-else, while, and for loops. It includes tasks such as character checks, electricity bill calculations, number reversals, palindrome checks, and generating sequences. The exercises aim to enhance programming skills through practical applications of basic concepts.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
AI Lab (391) – MCA 3rd Sem.
If-Else, While, For Programs
1. Write a python program to print the given character is A or B or C. If other characters,
print “letter is not A, B and C” using if-else. 2. Write a python program to print “The number is bigger than 10” and also print “The number lies between 30 and 40” if you give 31 to 39 using nested if statements. 3. Write a python program to print the given character is A or B or C. If other characters, print “letter is not A, B and C” using elif. 4. Write a program to calculate electricity bill for the following data Units less than 50 then Rs. 2.60 per unit and surcharge is Rs 25 Units between 50 to 100 then Rs 3.25 per unit and surcharge is Rs 35 Units between 100 to 200 then Rs 5.26 per units and surcharge is Rs 45 Units above 200 then Rs 8.45 and surcharge is Rs 75
5. Write a python program to reverse the given number.
6. Write a python program to reverse a number using while loop. 7. Write a python program to print the given string is palindrome or not. 8. Write a python program to print the given number is palindrome or not. 9. Write a python program to print values until you get negative value. 10. Write a python program to print a message once the condition is false using while and else. 11. Write a python program to print ODD numbers from 1 to 10 using for loop with continue. 12. Write a python program to print 10 natural numbers and odd numbers from 1 to 10. 13. Write a python program to print the numbers divisible by 7 from 1 to 100 using for loop. 14. Python program to print all the even numbers within the given range. 15. Python program to calculate the sum of all numbers from 1 to a given number. 16. Python program to count the total number of digits in a number. 17. Python program to check if the given string is a palindrome. 18. Python program to print the given number is Armstrong number or not 19. Write a python program to get valid password. (password should contains A-Z, a-z, 0- 9, !, @, #, $, %, &, * and 8 to 16 characters length.) 20. Python Program for Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +……. + n/n! 21. Write a python program to find and print the number if it occurs 3 times consecutively in the list.