-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
588 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
def hello(): | ||
for x in range(10): | ||
print('hello', x, end =" ") | ||
|
||
def sum_digit(n): | ||
sum1 = 0 | ||
while n!=0: | ||
sum1 += n%10 | ||
n = n//10 | ||
return sum1 | ||
|
||
def simple_interest(p,r,t): | ||
return p*r*t/100 | ||
|
||
def area_triangle(base,height): | ||
return base*height | ||
|
||
def isPrime(n): | ||
found =0 | ||
for x in range(2,(n//2)+1): | ||
if n%x==0: | ||
found=1 | ||
return found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from createModule import isPrime | ||
|
||
|
||
result = isPrime(11) | ||
if result ==0: | ||
print('Prime Number') | ||
else: | ||
print('Not a prime Number') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
import random | ||
|
||
unique=[] | ||
|
@@ -40,4 +41,4 @@ | |
if(counter>=6): | ||
break | ||
|
||
print(string) | ||
print(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import csv | ||
name = input('Name to delete :') | ||
# this is comment | ||
# hello rakesh this is comment | ||
""" this is multi line commnet""" | ||
|
||
records=[] | ||
found =0 | ||
file = open("student.csv","r") | ||
reader = csv.DictReader(file) | ||
for record in reader: | ||
record = dict(record) | ||
if(record['name']!=name): | ||
records.append(dict(record)) | ||
else: | ||
found =1 | ||
file.close() | ||
# Remove the old file and create a new csv file | ||
headers=['rollno','name','stream','fees'] | ||
file = open("student.csv","w") | ||
writer = csv.DictWriter(file,fieldnames =headers, lineterminator ='\n') | ||
writer.writeheader() | ||
writer.writerows(records) | ||
file.close() | ||
|
||
if(found==0): | ||
print(name, " does not exists") | ||
else: | ||
print(name," deleted successfully") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pickle | ||
rec=[] | ||
while True: | ||
roll= int(input('Enter Name :')) | ||
name=input('Enter your Name : ') | ||
record = [roll, name] | ||
rec.append(record) | ||
choice=input('Add More(Y/N ) ? ') | ||
if choice.upper() == 'N': | ||
break | ||
f = open("student", "wb") | ||
pickle.dump(rec, f) | ||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import csv | ||
|
||
rollno= int(input('Roll No :')) | ||
name = input('Name :') | ||
stream = input('Stream :') | ||
fees = int(input('Fees :')) | ||
|
||
records = [rollno,name,stream,fees] | ||
|
||
f = open("student.csv", "a") | ||
csvwriter = csv.writer(f, lineterminator='\n') | ||
# csvwriter.writerow(header) | ||
csvwriter.writerow(records) | ||
f.close() | ||
print("Record added ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# program to update a record in csv file | ||
import csv | ||
name = input('Name to Delete :') | ||
records = [] | ||
found = 0 | ||
file = open("student.csv", "r") | ||
reader = csv.reader(file) | ||
for record in reader: | ||
if(record[1]!= name): | ||
records.append(record) | ||
found = 1 | ||
|
||
file.close() | ||
|
||
# Remove the old file and create a new csv file | ||
file = open("student.csv", "w") | ||
writer = csv.writer(file,lineterminator='\n') | ||
writer.writerows(records) | ||
file.close() | ||
|
||
if(found == 0): | ||
print(name, " does not exists") | ||
else: | ||
print(name, " deleted successfully") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import csv | ||
f = open(r"C:\Users\rakesh\Desktop\student.csv", "r") | ||
data = csv.reader(f) | ||
for record in data: | ||
print(record) | ||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import csv | ||
f = open(r"C:\Users\rakesh\Desktop\student.csv", "r") | ||
data = csv.DictReader(f) | ||
for record in data: | ||
print(dict(record)) | ||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import csv | ||
name = input('Name to Search :') | ||
|
||
file = open('student.csv','r') | ||
reader = csv.DictReader(file) | ||
found =0 | ||
for x in reader: | ||
x = dict(x) | ||
if(x['name']==name): | ||
print(name,' found in CSV file..') | ||
found =1 | ||
file.close() | ||
|
||
if(found == 0): | ||
print(name, ' not found....') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import csv | ||
name = input('Name to Search :') | ||
|
||
file = open('student.csv', 'r') | ||
reader =csv.reader(file) | ||
found = 0 | ||
for x in reader: | ||
if(x[1] == name): | ||
print(name, ' found in CSV file..') | ||
found = 1 | ||
file.close() | ||
|
||
if(found == 0): | ||
print(name, ' not found....') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# program to update a record in csv file | ||
import csv | ||
name = input('Name to Update :') | ||
records = [] | ||
found = 0 | ||
file = open("student.csv", "r") | ||
reader = csv.DictReader(file) | ||
for record in reader: | ||
record = dict(record) | ||
if(record['name'] == name): | ||
record = dict(record) | ||
record['name'] =input('New Name:') | ||
records.append(record) | ||
found=1 | ||
else: | ||
records.append(dict(record)) | ||
file.close() | ||
|
||
# Remove the old file and create a new csv file | ||
pr | ||
headers = ['rollno', 'name', 'stream', 'fees'] | ||
file = open("student.csv", "w") | ||
writer = csv.DictWriter(file, fieldnames=headers, lineterminator='\n') | ||
writer.writeheader() | ||
writer.writerows(records) | ||
file.close() | ||
|
||
if(found == 0): | ||
print(name, " does not exists") | ||
else: | ||
print(name, " updated successfully") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import csv | ||
records =[ | ||
["ID", "name", "Price", "Qty"], | ||
["102","LG Monitor","6500","20"], | ||
["103","KeyBoard","1350","156"], | ||
["105","Hp Mouse","650","120"], | ||
["106","Speaker","1670","136"] | ||
] | ||
|
||
f = open("stock.csv","w") | ||
csvwriter = csv.writer(f,lineterminator="\n") | ||
# csvwriter.writerow(header) | ||
csvwriter.writerows(records) | ||
f.close() | ||
print("Check your file now....") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import csv | ||
headers =['rollno','name','stream','fees'] | ||
records = [ | ||
{'fees': 2356,'rollno': 12, 'name': 'surendra', 'stream': 'Humanities', }, | ||
{'rollno': 13, 'stream': 'Humanities', 'fees': 2356,'name': 'Ashok', }, | ||
{'rollno':15,'name':'Nipun','stream':'Humanities','fees':2356}, | ||
{'rollno': 22, 'name': 'Ayush Negi', 'fees': 2356,'stream': 'Science', }, | ||
] | ||
|
||
f = open("student.csv", "w") | ||
writer = csv.DictWriter(f, fieldnames = headers, lineterminator='\n') | ||
writer.writeheader() | ||
writer.writerows(records) | ||
f.close() | ||
print("Check your file now....") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
|
||
import csv | ||
import xlwt | ||
from tabulate import tabulate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# program to print bar graph on the screen | ||
# made by : rakesh kumar | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
x = ['Delhi', 'Banglore', 'Chennai', 'Pune'] | ||
y = [250, 300, 260, 400] | ||
city = ['Delhi', 'Banglore', 'Chennai', 'Pune'] | ||
sales = [250, 300, 260, 400] | ||
plt.xlabel('City') | ||
plt.ylabel('Sales in Million') | ||
plt.title('Sales Recorded in Major Cities') | ||
plt.bar(x, y) | ||
plt.bar(city, sales) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import matplotlib.pyplot as plt | ||
x = [1, 3, 4, 7, 8, 8, 9] | ||
plt.boxplot(x) | ||
plt.grid() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import matplotlib.pyplot as plt | ||
list1 = [10, 33, 43, 74, 84, 8, 9,35,63,5,3,67,8,78,35,2,57,7,78,34,67,34] | ||
list2 = [23,3,5,67,67,78,98,90,100,12,45,67,89,45,56,78,9,23,69,56,23,5] | ||
plt.boxplot([list1,list2],labels=['Girls','Boys']) | ||
plt.grid() | ||
plt.legend() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import numpy as np | ||
x = np.arange(1,100) | ||
y = np.arange(101,200) | ||
z= np.arange(201,250) | ||
plt.boxplot([x,y,z]) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
import matplotlib.pyplot as plt | ||
<<<<<<< HEAD | ||
======= | ||
from numpy import linspace,pi,sin,cos,tan | ||
|
||
#multiple figures | ||
data=[1,2,3,4,5, | ||
10,11,12,14,15,18,16,14,13,12,19,20,16,14,19, | ||
22, 21, 22, 23, 24, 25, 23, 26, 28, 26,27,25,28,29,30, | ||
32,33,37,38,38,39,34,36, | ||
42,43,45,46,48,46,49,50,43,42,44,45,47,49,50,49,48,42,46,41,45,46,48,45,44, | ||
51,52,54,55,53,58,57,59,60,52,51,54,53 | ||
] | ||
frequency = [5,15,18,8,25,13] | ||
x = [5,15,25.5,35.5,45.5,55.5] | ||
|
||
|
||
plt.figure(1) | ||
plt.hist(data,bins=[0,10,20,30,40,50,60],color="green") | ||
plt.scatter(frequency,x) | ||
plt.show() | ||
>>>>>>> da25a2a32ac30d0980ed6d1d3ad58008d8ff0b21 |
Oops, something went wrong.