Python Assignment
Python Assignment
Modularization:
Create 5 objects of Rectangle. Get the data from user through keyboard and set in all
objects. Print the area of every object
File Handling:
1. Write a program to read each line of the file one by one and display output with a line number
in the beginning.
2. Create a file names.txt and store 10 different user names in that file, one user name in one line.
Now write a script that accepts user name as command line argument, checks whether a similar
name exists in names.txt, if yes, it asks you to provide the Age, Salary and Phone no for that user
and store all these details in a file called userdata.txt in the current directory.
3. Provide source file and destination file names as command line arguments. Perform following
functionality:
Program should copy contents of source file to destination file
If source file does not exist, display appropriate error message
If destination file does not exist, it should be created.
If destination file already exist, program should ask Want to Overwrite? (yes/no). If user selects
Yes then overwrite otherwise append
Ask user to enter details of an employee and set them in an Employee object.
Store details of this object in a file emp.txt
Read employee details from the file and display those details