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/ 2
Python Assignment Programs.
Instructor: Saumitra Biswas
1. Create a list of numbers by taking comma-separated values from the user.
2. Write a function that will check whether a given number is even or odd. 3. Write a function that will print all even numbers from 1 to 100. 4. Write a function that will return all even numbers and all odd numbers from a given range in two separate lists. 5. Write a function that will answer whether a given number is prime or not. 6. Write a function that will return all prime numbers between given range. 7. Write a function that will return all the digits of a given number packed in a list/tuple. 8. Write a function that will return the sum and product of all digits of a given number. 9. Write a function that will return the reverse of a given number. 10.Write a function that will return whether a given number is Armstrong number or not. 11. Write a function that will return whether a given number is a Palindrome number or not. 12. Write a function that will return all Palindrome numbers within a given range. 13. Write a function that will return all factors of a given number. 14. Write a function that will return all prime factors of a given number. 15. Write a function that will return all mutiples of a given number within a given range. 16. Write a function that will return a list of Fibonacci numbers upto a given term. 17. Write a function that will return the number corresponding to a given term of the Fibonacci series. 18. Write a function which will return the factorial of a given number. 19. Write a recursive function which will return the factorial of a given number. 20. Write a function that adds two given numbers using recursion. 21. Write a function that mutiplies two given numbers using recursion. 22. Write a function that returns the minimum, maximum, sum, product, average of a given list. 23. Write a function that will return all the prime elements of a given list. 24. Write a function that will return reverse of a given list. Do not use any list method. 25. Write a function that will take a list of numbers with duplicates and returns a list of numbers without duplicates. 26. Write a function that will return whether a given string is a Palindrome or not. 27. Open a text file and print the contents. 28. Open a text file and write some content to it.Copy a binary file to another binary file. 29. Copy a text file to another text file. 30. Open a text file and print the contents. Add a line number to each line of output. 31. Copy a binary file to another binary file. 32. Show how you can save your program data using Pickle. 33. Show how you can save your program data using JSON. 34. Create and show the functionality of a function that has default arguments. 35. Create and show the functionality of a function that takes variable-length non-keyworded arguments. 36. Create and show the functionality of a function that takes both variable-length non-keyworded arguments and variable-length keyworded arguments. 37. Suppose you have two functions, f1 and f2. f3 is another function that takes a function as one of the arguments. It can have other arguments. Inside f3, the supplied function will be called using the other parameters of f3. Call f3, by passing f1 and other parameters. Then call f3, by passing f2 and other parameters. 38. Print the sum, 1 + 2 + 3 + ... + n. 39. Print the sum, 1^1 + 2^2 + 3^3 + ... + n^n. 40. Print the sum, 1 + (1+2) + (1+2+3) + ... + (1+2+3+...+n). 41. Print the sum, 1! + 2! + 3! + ... + n!. 42. Print the sum, (1!/1) + (2!/2) + (3!/3) + ... + (n!/n). 43. Print the sum, 1 + 1/2 + 1/3 + .... + 1/n. 44. Print the sum, 1/2 + (- 2/3) + 3/4 - 4/5 + 5/6 - ... n. 45. Print the sum, 1^2 + 2^2 + 3^2 + .... + n^2.
Write Python Programs that will print the following patterns.
46.
1 12 123 1234 12345 47.
1 22 333 4444 55555
48.
55555 4444 333 22 1
49.
12345 1234 123 12 1
50.
12345 2345 345 45 5
51.
1 12 123 1234 12345
52.
* ** *** **** *****
53. Create and show the functionality of a module.
54. Create and show the functionality of a package.