Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create assignment 4 #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Introduction-to-Data-Science/Week-3/aditya-rastogi/assignment 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
1.
ab+ mode is used to open a file for appending and reading in binary format.If file does not exist it is created.
File pointer is located at end of file on opening.
2.
Buffering is useful when you don't know the size of file you are working with.
If the file size is greater than computer memory then processing unit will not function properly.
The buffer size tells how much data can be held at a time until it is used.
3.
try:
a=int(input("Enter no.\n"))
b=int(input("Enter divisor\n"))
file1=open(input("Enter file name to store quotient\n"),'r+')
file1.seek(0,2)
file1.write(str(a/b))
file1.close()
except IOError:
print("ERROR Enter valid filename")
except ValueError:
print("ERROR enter integer")
except ZeroDivisionError:
print("ERROR can't divide by zero")
4.
file1=open("abc.txt",'r')
list1=file1.readlines()
list1.reverse()
for item in list1:
print(item,end="")
file1.close()