We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Assignment -2 (Programming using Python)
1. WAP to print Hello-World!!
2. WAP to swap values among two variables 3. WAP to swap values using an extra variable. 4. WAP to do various arithmetical operations {add, sub, mul, div } 5. WAP to check if a no is positive, negative or zero. 6. WAP to find ASCII values of a character. 7. WAP to find the area of a square, triangle, rectangle and circle. 8. WAP to check if it’s a leap year or not. 9. WAP to check whether a no is odd/even. 10. WAP to check whether a no is prime or not. 11. WAP to find all prime numbers within a range. 12. WAP to take a single digit number from the keyboard and print its value in English word? 13. WAP to check for the Armstrong number {407,157} 407= 4^3+0^3+7^3= 64+0+349=407} 14. WAP to check for the Disarium number. {175= 1^1 + 7^2+ 5^3= 1+49+125=175} 15. WAP to find LCM and HCF of a given no. 16. WAP to use break, continue and pass statements. 17. WAP to check greatest/smallest of the three numbers. 18. WAP to check 2nd greatest/smallest of the three numbers. 19. WAP to get the factorial of a number. 20. WAP for Fibonacci series. 21. WAP to check if a no is palindrome or not. 22. WAP to find the sum of natural no/ odd no/ even no. 23. WAP to get the cube of sum of n natural no’s. 24. WAP to sum any given number {123=>1+2+3=>6}. 25. WAP to reverse any given number {123=>321}. 26. WAP to print all Possible Combinations from any three digit number. 27. WAP to check the length of a string. 28. WAP to reverse a string. 29. WAP to sort alphabets in a string. {dcabe will become abcde or edcba} 30. WAP to sort elements in a list. 31. WAP to swap adjacent letters in a string. {Eg: string will become tsirgn} 32. WAP to check for a specific letter in a string. 33. WAP to check and count given any specific letter in a string. 34. WAP to accept any string which contain any of the vowels {a, e, I, o, u}. 35. WAP to check for a number in a list. 36. WAP to find the largest/smallest no in a list. 37. WAP to find the second largest/smallest no in a list. 38. WAP to add, subtract and multiply two matrices of a no. 39. Write a Python program to count the number of strings where the string length is 2 or more and the first and last character are same from a given list of strings. [ 'abc', 'xyz', 'aba', '1221' ] => 2 40. Write a Python program to remove duplicates from a list [1,2,3,7,2,1,5,6,4,8,5,4] => [1,2,3,4,5,6,7,8]
41. Write a Program that get two lists as input and check if they have at least one common member. [1, 2, 3, 4, 5] & [5, 6, 7, 8, 9] => {both have one no in common which is 5}
42.
43.
44. WAP to print the table of any no in the below format