Programming Assignment-1
Programming Assignment-1
1. Write a program that takes two numbers as input and prints their sum.
2. Write a python program that checks whether a given number is even or
odd.
3. Write a python program that calculates the factorial of a given number.
4. Write a program that asks the user for their name and then prints a
greeting message.
5. Write a program that takes a string input from the user and writes it to a
text file.
6. Write a program that reads the content of a text file and prints it to the
console.
7. Write a python program that takes a string as input and returns its length.
8. Write a python program that concatenates two strings and returns the
result.
9. Write a python program that checks if a substring is present in a given
string.
10. Write a python program that converts a given string to uppercase.
11. Write a python program that generates the first n numbers in the
Fibonacci sequence.
12. Write a python program that calculates the sum of the digits of a given
number.
13. Write a program that asks the user for their birth year and calculates their
age.
14. Write a program that reads multiple lines of input from the user until they
enter an empty line, then prints all the lines.
15. Write a program that reads data from a CSV file and prints it to the
console.
16. Write a program in python that counts the frequency of each character in
a string.
17. Write a program in python that converts a given string to title case (first
letter of each word capitalized).
18. Write a python program that checks if two strings are anagrams of each
other.
19. Write a python program that removes all punctuation from a given string.
20. Write a python program that takes a list of numbers and returns their sum.
1|Page
PYTHON PROGRAMMING BASIC PART-1
21. Write a python program that counts the occurrences of a specific element
in a list.
22. Write a python program that returns the minimum and maximum values
in a list of numbers.
23. Write a program that converts temperature from Celsius to Fahrenheit
and vice versa based on user input.
24. Write a program that acts as a simple calculator. It should take two
numbers and an operator (+, -, *, /) as input and print the result.
25. Write a program that copies the contents of one text file to another.
26. Write a program in python that checks if a string starts with a given prefix
or ends with a given suffix.
27. Write a program in python that converts a string into a list of its characters.
2|Page