Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
misskalyani authored Dec 12, 2024
1 parent c76a07b commit a2c2d17
Show file tree
Hide file tree
Showing 9 changed files with 4,147 additions and 0 deletions.
745 changes: 745 additions & 0 deletions Asignment 2.ipynb

Large diffs are not rendered by default.

740 changes: 740 additions & 0 deletions Asignment No 3.ipynb

Large diffs are not rendered by default.

492 changes: 492 additions & 0 deletions FILE HANDLING.ipynb

Large diffs are not rendered by default.

1,734 changes: 1,734 additions & 0 deletions Untitled1.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions abc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
java
php
python
171 changes: 171 additions & 0 deletions kalyani.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
HII....I am Kalyani Chaudhari..
I am studying in TY BCS Computer Science at RBNB College.
I am from Jalgaon.
I am learning Java,PHp,python,DS,OS etc..

#Write a python program to write a list to a file.
f1=open("abc.txt","w")
l1=["java","php","python"]
for i in l1:
f1.write(i+"\n")
f1.close()
print("Write Successfully...")

#Write a python program to get the file size of a plain file
f=open("abc.txt","r")
s=f.read()
print("size =",len(s))
f.close()

#Write a python program to count the frequency of words in a file

f1=open("abc.txt","r")
s=f1.read()
s1=s.split(" ")
l1=[]
for i in s1:
if i not in l1:
print(i,"count",s1.count(i))
l1.append(i)
f1.close()

#Write a python program to count the frequency of words in a file
f1=open("abc.txt","r")
c=0
while True:
s=f1.readline()
c=c+1;
if s=="":
break;
print("number of lines =",c)
f1.close()

#Write a python program to find the longest words
f1=open("abc.txt","r")
s=f1.read()
s1=s.split(" ")
s2=""
for i in s1:
if len(i)>len(s2):
s2=i
print("Longest Word = ",s2)
f1.close()

#Write a python program to read a file line by line store it into vairable
f1=open("abc.txt","r")
s1=""
while True:
s=f1.readline()
if s=="":
break
s1=s1+s
print("Varibale = ",s1)
f1.close()

#Write a python program to read a file line by line store it into list
f1=open("abc.txt","r")
l1=[]
while True:
s1=f1.readline()
if s1=="":
break
l1.append(s1)
print("list =",l1)
f1.close()

#Write a python program to read last n lines
f1=open("abc.txt","r")
n=int(input("Enter Lines"))
lines=f1.readlines()
for i in lines[-n:]:
print(i,end='')
f1.close()

#Write a python program to append text to a file and display the text
f1=open("xyz.txt","w")
f1.write("\nRBNB College Shrirampur")
f1.close()

f1=open("xyz.txt","r")
a=f1.read()
print(a)
f1.close()

#Write a python program to read first n lines
f1=open("kalyani.txt","r")
n=int(input("Enter No of Lines to read"))
for i in range(0,n):
a=f1.readline()
print(a,end="")
f1.close()


#Write a python program to read first n lines
f1=open("kalyani.txt","r")
s=f1.readlines()
n=int(input("Enter no of lines to read"))
for i in range(0,n):
print(s[i],end="")
f1.close()


#Write a python program to print each line of file in reverse order
f1=open("abc.txt","r")
while True:
s=f1.readline()
if s=="":
break
print(s[::-1],end="")
f1.close()


#Write a python program to append text to a file and display the text
f1=open("pqr.txt","w")
f1.write("HIIIIIIII HELLOOOOOO")
a=f1.read()
print(a)
f1.close()


#Write a python program to compute the no.of characters ,words and line in a file
f1=open("kalyani.txt","r")
c1=0
w=0
l=0
while True:
s=f1.readline()
l=l+len(s)
if s=="":
break
c1=c1+1#line count
s1=s.split(" ")
for a in s1:
w=w+1
print("lines=",c1)
print("words=",w)
print("char=",l)

#copy content from one file to another file
f1=open("abc.txt","r")
f2=open("pqr.txt","w")
while True:
s=f1.readline()
if s=="":
break
f2.write(s)
f1.close()
f2.close()
print("File copy succesfully..")

#write text in to file
f1=open("abc.txt","w")
f1.write("Hiii HELLOo")
f1.close()
print("file write succ...")


#read file
f1=open("abc.txt","r")
s=f1.read()
print(s)
f1.close()
Loading

0 comments on commit a2c2d17

Please sign in to comment.