Skip to content

Commit 2754dca

Browse files
authored
Merge branch 'geekcomputers:master' into master
2 parents fa5f487 + c37973c commit 2754dca

File tree

703 files changed

+267183
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

703 files changed

+267183
-0
lines changed

.Python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Library/Frameworks/Python.framework/Versions/3.8/Python

.github/workflows/lint_python.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: lint_python
2+
on:
3+
pull_request:
4+
push:
5+
# branches: [master]
6+
jobs:
7+
lint_python:
8+
runs-on: ubuntu-latest
9+
# strategy:
10+
# matrix:
11+
# os: [ubuntu-latest, macos-latest, windows-latest]
12+
# python-version: [2.7, 3.5, 3.6, 3.7, 3.8] # , pypy3]
13+
steps:
14+
- uses: actions/checkout@master
15+
- uses: actions/setup-python@master
16+
- run: pip install black codespell flake8 isort pytest
17+
- run: black --check . || true
18+
# - run: black --diff . || true
19+
# - if: matrix.python-version >= 3.6
20+
# run: |
21+
# pip install black
22+
# black --check .
23+
- run: codespell --quiet-level=2 || true # --ignore-words-list="" --skip=""
24+
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
25+
- run: isort --recursive . || true
26+
- run: pip install -r requirements.txt || true
27+
- run: pytest .

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.idea
2+
*.pyc
3+
string=sorted(input())
4+
lower=""
5+
even=""
6+
odd=""
7+
upper=""
8+
for i in string:
9+
if i.islower():
10+
lower+=i
11+
elif i.isupper():
12+
upper+=i
13+
elif int(i)%2==0:
14+
even+=i
15+
else:
16+
odd+=i
17+
print(lower+upper+odd+even)
18+
19+
# operating system-related files
20+
21+
# file properties cache/storage on macOS
22+
*.DS_Store
23+
24+
# thumbnail cache on Windows
25+
Thumbs.db
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pickle
2+
def Bdelete():
3+
F= open("studrec.dat","rb")
4+
stud = pickle.load(F)
5+
F.close()
6+
print(stud)
7+
rno= int(input("Enter the roll number to be deleted"))
8+
F= open("studrec.dat","wb")
9+
rec= []
10+
for i in stud:
11+
if i[0] == rno:
12+
continue
13+
rec.append(i)
14+
pickle.dump(rec,F)
15+
F.close()
16+
Bdelete()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pickle
2+
3+
def binaryread():
4+
B=open("studrec.dat","rb")
5+
stud=pickle.load(B)
6+
print(stud)
7+
8+
# prints the whole record in nested list format
9+
print("contents of binary file")
10+
11+
for ch in stud:
12+
13+
print(ch) #prints one of the chosen rec in list
14+
15+
Rno=ch[0]
16+
Rname=ch[1] #due to unpacking the val not printed in list format
17+
Rmark=ch[2]
18+
19+
print(Rno, Rname,Rmark, end="\t")
20+
21+
B.close
22+
23+
binaryread()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#Updating records in a binary file
2+
3+
import pickle
4+
5+
def update():
6+
F=open("class.dat",'rb+')
7+
S=pickle.load(F)
8+
found=0
9+
rno=int(input("enter the roll number you want to update"))
10+
for i in S:
11+
if rno==i[0]:
12+
print("the currrent name is",i[1])
13+
i[1]=input("enter the new name")
14+
found=1
15+
break
16+
17+
if found==0:
18+
print("Record not found")
19+
20+
else:
21+
F.seek(0)
22+
pickle.dump(S,F)
23+
24+
F.close()
25+
26+
update()
27+
28+
F=open("class.dat","rb")
29+
val=pickle.load(F)
30+
print(val)
31+
F.close()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#updating records in a bnary file
2+
3+
import pickle
4+
5+
def update():
6+
F=open("studrec.dat","rb+")
7+
value=pickle.load(F)
8+
found=0
9+
roll=int(input("Enter the roll number of the record"))
10+
for i in value:
11+
if roll==i[0]:
12+
print("current name", i[1])
13+
print("current marks", i[2])
14+
i[1]=input("Enter the new name")
15+
i[2]=int(input("Enter the new marks"))
16+
found=1
17+
18+
if found==0:
19+
print("Record not found")
20+
21+
else:
22+
pickle.dump(value,F)
23+
F.seek(0)
24+
newval=pickle.load(F)
25+
print(newval)
26+
27+
F.close()
28+
update()
29+
30+
471 Bytes
Binary file not shown.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
'''Amit is a monitor of class XII-A and he stored the record of all
2+
the students of his class in a file named “class.dat”.
3+
Structure of record is [roll number, name, percentage]. His computer
4+
teacher has assigned the following duty to Amit
5+
6+
Write a function remcount( ) to count the number of students who need
7+
remedial class (student who scored less than 40 percent)
8+
9+
10+
'''
11+
#also find no. of children who got top marks
12+
13+
import pickle
14+
F=open("class.dat",'ab')
15+
list=[[1,"Ramya",30],[2,"vaishnavi",60],[3,"anuya",40],[4,"kamala",30],[5,"anuraag",10],[6,"Reshi",77],[7,"Biancaa.R",100],[8,"sandhya",65]]
16+
17+
18+
pickle.dump(list,F)
19+
F.close()
20+
21+
def remcount():
22+
F=open("class.dat","rb")
23+
val=pickle.load(F)
24+
count=0
25+
26+
for i in val:
27+
if i[2]<=40:
28+
print(i,"eligible for remedial")
29+
count+=1
30+
print("the total number of students are",count)
31+
F.close()
32+
33+
remcount()
34+
35+
def firstmark():
36+
F=open("class.dat",'rb')
37+
val=pickle.load(F)
38+
main=[]
39+
count=0
40+
41+
for i in val:
42+
data=i[2]
43+
main.append(data)
44+
45+
top=max(main)
46+
print(top,"is the first mark")
47+
48+
F.seek(0)
49+
for i in val:
50+
if top==i[2]:
51+
print(i)
52+
print("congrats")
53+
count+=1
54+
55+
56+
print("the total number of students who secured top marks are",count)
57+
F.close()
58+
firstmark()
59+
60+
F=open("class.dat","rb")
61+
val=pickle.load(F)
62+
print(val)
63+
F.close()
64+
65+
66+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#binary file to search a given record
2+
3+
import pickle
4+
5+
def binary_search():
6+
F=open("studrec.dat",'rb')
7+
# your file path will be different
8+
value=pickle.load(F)
9+
search=0
10+
rno=int(input("Enter the roll number of the student"))
11+
12+
for i in value:
13+
if i[0]== rno:
14+
print("Record found successfully")
15+
print(i)
16+
search=1
17+
18+
if search==0:
19+
print("Sorry! record not found")
20+
F.close()
21+
22+
binary_search()

0 commit comments

Comments
 (0)