CSE1012 - PROBLEM-SOLVING-USING-PYTHON - ETH - 2.0 - 12 - CSE1012 - Problem Solving Using Python - 2.0
CSE1012 - PROBLEM-SOLVING-USING-PYTHON - ETH - 2.0 - 12 - CSE1012 - Problem Solving Using Python - 2.0
File I/O-Opening and Closing files, Different modes, File attributes, Read, Write
Operations, File Positions. Renaming and Deleting Files, various directory handling
functions.
Text Books
1. Kenneth Lambert, “Fundamentals of Python: First Programs”, Cengage Learning,
2019
2. Martin C Brown, “The Complete Reference with Python”, McGrawHill, 2018.
References
1. John Zelle, Python Programming: An introduction to Computer Science, Franklin
Associates, Third Edition, 2016.
2. Mark Lutz, “Learning Python”, Fifth edition, O’Reilly, 2013.
List of Laboratory Experiments
Week 1:
1. Write a Python program to display the current date and time.
2. Write a Python program to get the Python version you are using
3. Write a Python program that accepts an integer (n) and computes the value of
n+nn+nnn
4. Write a Python program to read and print various types of variables.
5. Write a Python program to print the calendar of a given month and year.
Week 2:
Week 4:
1. Write a program which will find all such numbers which are divisible by 7 but are
not a multiple of 5, between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separated sequence on a single
line. Consider use range(#begin, #end) method
2. Write a python program to check whether a number is divisible by 5 and 11 or not.
3. Write a python program to check whether a character is alphabet or not.
4. Write a python program to input any character and check whether it is alphabet,
digit or special character.
5. Write a python program to check whether a character is uppercase or lowercase
alphabet.
6. Write a python program to input week number and print week day.
7. Write a python program to count total number of notes in given amount
Week 5:
1. Write a Python program to print all natural numbers from 1 to n. - using while loop
2. Write a Python program to find sum of all odd numbers between 1 to n.
3. Write a Python program to count number of digits in a number.
4. Write a Python program to find first and last digit of a number.
5. Write a Python program to calculate sum of digits of a number.
6. Write a Python program to enter a number and print its reverse.
Week 6:
1. Write a Python program to check whether a number is palindrome or not.
2. Write a Python program to find frequency of each digit in a given integer.
3. Write a Python program to print all ASCII character with their values.
4. Write a Python program to find all factors of a number.
5. Write a Python program to calculate factorial of a number.
6. Write a Python program to print all Prime numbers between 1 to n.
7. Write a Python program to check whether a number is Armstrong number or Strong
or Prime Number or Perfect number or magic number or not
8. Write a Python program to print Fibonacci series up to n terms.
Week 7:
Week 8:
1. Write a Python program to get the 4th element and 4th element from last of a tuple
2. Write a Python program to find the repeated items of a tuple.
3. Write a Python program to check whether an element exists within a tuple
4. Write a Python program to unzip a list of tuples into individual lists.
5. Write a Python program to replace last value of tuples in a list.
Sample list: [(10, 20, 40), (40, 50, 60), (70, 80, 90)]
Expected Output: [(10, 20, 100), (40, 50, 100), (70, 80, 100)]
6. Write a Python program to remove an empty tuple(s) from a list of tuples.
Sample data: [(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')]
Expected output: [('',), ('a', 'b'), ('a', 'b', 'c'), 'd']
7. Write a Python program to convert a list of tuples into a dictionary.
8. Write a Python program to find the highest 3 values of corresponding keys in a
dictionary.
Week 9:
1. Write a Python function that prints out the first n rows of Pascal's triangle.
2. Write a Python function to create and print a list where the values are square of
numbers between 1 and 30 (both included).
3. Write a Python program to detect the number of local variables declared in a
function
4. Write a Python program that invoke a given function after specific milliseconds.
5. Write a Python program to get the sum of a non-negative integer
Week 10:
Week 11:
1. Write a Python Program to Replace all Occurrences of ‘a’ with ‘b’ in a String. If ‘a’
is not present, then print appropriate message.
2. Write a Python Program to Remove the nth Index Character from a Non-Empty
String
3. Write a Python Program to Detect if Two Strings are Anagrams
4. Write a Python Program to Form a New String where the First Character and the
Last Character have been Exchanged.
Week 12:
1. Write a Python program to get the last part of a string before a specified character
2. Write a Python program to count the occurrences of each word in a given sentence.
3. Write a Python function to insert a string in the middle of a string.
4. Write a Python function to get a string made of its first three characters of a specified
string. If the length of the string is less than 3 then return the original string.
5. Write a Python program to add a prefix text to all of the lines in a string
6. Write a Python program to convert a given string into a list of words.