Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshsaraswat authored May 31, 2022
1 parent 424d727 commit 9f588bf
Show file tree
Hide file tree
Showing 68 changed files with 665 additions and 0 deletions.
32 changes: 32 additions & 0 deletions 1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from tkinter import*
from tkinter import filedialog
import pyttsx3
import PyPDF2
Window=Tk()
Window.geometry('500x350')
Window.config(bg="orange")
Window.title("Convert PDF File Text to Audio Speech Using Python by Our Team")
startingpagenumber = Entry(Window)
page1.place(relx=0.02,rely=0.1)
startingpagenumber.place(relx=0.6,rely=0.1)
page1=Label(Window,text=1)
label = Label(Window, text="select a book.")
label.place(relx=0.3,rely=0.2)

def file():
path = filedialog.askopenfilename()
book = open(path, 'rb')
pdfreader = PyPDF2.PdfFileReader(book)
pages = pdfreader.numPages
speaker = pyttsx3.init()

for i in range(int(startingpagenumber.get()), pages):
page = pdfreader.getPage(i)
txt = page.extractText()
speaker.say(txt)
speaker.runAndWait()

B=Button(Window, text="Choose the Book", command=file)
B.place(relx=0.4,rely=0.3)

mainloop()
Binary file added PYTHON PROGRAMS.docx
Binary file not shown.
46 changes: 46 additions & 0 deletions Total number of notes in amount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
a=int(input("Enter the amount : "))
n2000=n500=n200=n100=n50=n20=n10=n5=n2=n1=0
if(a>=2000):
n2000=a//2000
a=a-n2000*2000
if(a>=500):
n500=a//500
a=a-n500*500
if(a>=200):
n200=a//200
a=a-n200*200
if(a>=100):
n100=a//100
a=a-n100*100
if(a>=50):
n50=a//50
a=a-n50*50
if(a>=20):
n20=a//20
a=a-n20*20
if(a>=10):
n10=a//10
a=a-n10*10
if(a>=5):
n5=a//5
a=a-n5*5
if(a>=2):
n2=a//2
a=a-n2*2
if(a>=1):
n1=a//1
a=a-n1*1
print("Noes of 2000 = ",n2000)
print("Noes of 500 = ",n500)
print("Noes of 200 = ",n200)
print("Noes of 100 = ",n100)
print("Noes of 50 = ",n50)
print("Noes of 20 = ",n20)
print("Noes of 10 = ",n10)
print("Noes of 5 = ",n5)
print("Noes of 2 = ",n2)
print("Noes of 1 = ",n1)




9 changes: 9 additions & 0 deletions area_of_scalen_triangle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# write a program to find the area of the triangle
# by using heron's formula
a1=int(input("Enter the side 1 : "))
a3=int(input("Enter the side 3 : "))
a2=int(input("Enter the side 2 : "))
# first we find semi parimeter
s=(a1+a2+a3)/2
area=(s*(s-a1)*(s-a2)*(s-a3))**0.5
print("Area of the scalen triangle is %d unit^2"%area)
7 changes: 7 additions & 0 deletions avg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a=85
b=68
c=59
d=78
e=(82*500/100)-(a+b+c+d)
print(e)

5 changes: 5 additions & 0 deletions body mass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# write a program to find BMII(body mass index) ?
h=int(input("Enter your height in meter :"))
w=int(input("Enter your weight in kg :"))
bmi=w/(h**2)
print("Your body mass is",bmi)
5 changes: 5 additions & 0 deletions cal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a=input("enter a string")
b=input("enter 2 string")
c=a+b
print(c)

3 changes: 3 additions & 0 deletions calender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from calendar import*
year=int(input("Enter year:"))
print(calendar(year))
7 changes: 7 additions & 0 deletions check even_odd_using_lambda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
f=lambda a:True if a%2==0 else False
n=int(input("Enter the number to check :"))
b=f(n)
if(b==True):
print("It is even number")
else:
print("Not even")
5 changes: 5 additions & 0 deletions check last digit binary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# write a python program to check wether last digit is binary or not
a=int(input("Enter the number that you want to check : "))
n=a%10
b=n&1
print("Last binary digit is ",b)
6 changes: 6 additions & 0 deletions convert list item in upperrcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# sample input=['kanishk', 'ritik', 'rahul', 'govind', 'dev']
# sample output+=['KANISHK', 'RITIK', 'RAHUL', 'GOVIND', 'DEV']
a=input("Enter string with space:").split()
print(a)
lst=list(map(lambda x:x.upper(), a))
print(lst)
3 changes: 3 additions & 0 deletions cricket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
o=int(input("Enter the number of overs :"))
run=(o-1)*33+36
print("Total run score by player in %d overs is %d"%(o,run))
13 changes: 13 additions & 0 deletions currency_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
a=int(input("Enter the money to be withdrawn : "))
ahundred=1
a=a-100
twothousand=a//2000
rem=a%2000
fivehundred=rem//500
r=rem%500
hundred=r//100


print("Number of 2000 notes : ",twothousand)
print("Number of 500 notes : ",fivehundred)
print("Number of hundred notes : ",ahundred+hundred)
7 changes: 7 additions & 0 deletions distance between two co-ordinate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# write a program to find the distance between two co-ordinate
a1=int(input("Enter a1 : "))
a2=int(input("Enter a2 : "))
b1=int(input("Enter b1 : "))
b2=int(input("Enter b2 : "))
d=(((a2-a1)**2)+((b2-b1)**2))**0.5
print("Distance between two points is ",d)
3 changes: 3 additions & 0 deletions distance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
d=int(input("Enter distance in meters :"))
d=d//1000
print("Distance in kilometers is ",d)
6 changes: 6 additions & 0 deletions even numbers in list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lst=[10,20,23,24,25,26]
a=list(filter(lambda x:(x%2==0),lst))
print(a)



7 changes: 7 additions & 0 deletions fabonacci_fun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def fun(x):
a,b=0,1
for i in range(x):
print(a)
a,b=b,a+b
n=int(input("Enter the number of terms :"))
fun(n)
9 changes: 9 additions & 0 deletions fabonaci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
l=int(input("Enter the number of terms:"))

y=lambda x,y:x+y

a,b=0,1
for i in range (l):
c=y(a,b)
print(a,end=" ")
a,b=b,c
23 changes: 23 additions & 0 deletions field project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# importing the modules
from http.cookies import BaseCookie
import PyPDF2
import pyttsx3

# path of the PDF file
path = open('C:\\Users\\kanis\\OneDrive\\Desktop\\Fitting Shop.pdf', 'rb')

# creating a PdfFileReader object
pdfReader = PyPDF2.PdfFileReader(path)

# the page with which you want to start
# this will read the page of 25th page.
from_page = pdfReader.getPage(1)

# extracting the text from the PDF
text = from_page.extractText()


# reading the text
speak = pyttsx3.init()
speak.say(text)
speak.runAndWait()
8 changes: 8 additions & 0 deletions filter even.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def even(n):
if(n%2==0):
return True
else:
return False
lst=[2,3,4,5,6,7,8]
a=list(filter((even),lst))
print(a)
16 changes: 16 additions & 0 deletions filter positive from list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lst=list(map(int,input("Enter the element of list with a space").split()))
print(lst)

#by using lambda
# lst2=list(filter(lambda x:x>0 ,lst))
#print(lst2)

#without using lambda
def abc(a):
if(a>0):
return True
else:
return False

lst2=list(filter(abc,lst))
print(lst2)
7 changes: 7 additions & 0 deletions find factorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def fact(a):
fact=1
for i in range(a,0,-1):
fact*=i
return fact
n=int(input("Enter the number to find factorial"))
print("factorial is ",fact(n))
11 changes: 11 additions & 0 deletions find maximum of three nmumbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def num(a,b,c):
if((a>b) and (a>c)):
return(a)
elif((b>c) and (b>a)):
return(b)
else:
return(c)
a1=int(input("Enter 1 no:"))
a2=int(input("Enter 2 no:"))
a3=int(input("Enter 3 no:"))
print("maxim no is",num(a1,a2,a3))
3 changes: 3 additions & 0 deletions find_palindromme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lst=['php','w3r','mom','sas','ass']
a=list(filter(lambda x: x==x[-1: :-1],lst))
print(a)
11 changes: 11 additions & 0 deletions generators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def mygen(x,y):
while(x<y):
yield x
x+=1

a=int(input("Enter starting limit:"))
b=int(input("Enter the end limit:"))

g=mygen(a,b)
for i in g:
print(i,end=" ")
25 changes: 25 additions & 0 deletions global_local_nonlocal_variable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'''# program to know global and local variable
a=20
def fun():
global a #to access global variable in loc
a=a+20
print(a)
fun()
print(a) # now the value of a is changed '''



# program to know non local variable
def fun():
a=20 # Non local variable
def asc():
nonlocal a
a=10+a
print(a)

asc()
print(a)

fun()
17 changes: 17 additions & 0 deletions hamming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def hamming(a,b):
c=a^b
d=bin(c)
e=str(d)
f=len(e)
suma=0
for i in range(f):

if(e[i]=='1'):
suma+=1
print("Hamming distance is ",suma)

n1=int(input("Enter the first no:"))
n2=int(input("Enter the second no:"))
hamming(n1,n2)


6 changes: 6 additions & 0 deletions height.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# write a program to find height if area and parameter are given
area=int(input("Enter the area : "))
parameter=int(input("Enter the parameter : "))
a=parameter//4
h=area//a
print("height is ",h)
5 changes: 5 additions & 0 deletions hypotenure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#write a python program to calculate hypotenure if base and perpendicular input by user
a=int(input("Enter the perpendicular : "))
b=int(input("Enter the base : "))
hypotenure=(a**2+b**2)**0.5
print(hypotenure)
16 changes: 16 additions & 0 deletions if_else_11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# python program to input week number and print the day
a=int(input("Enter weekday number from 1-7 : "))
if(a==1):
print("day is monday!")
elif(a==2):
print("day is tuesday!")
elif(a==4):
print("day is thursday!")
elif(a==5):
print("day is friday!")
elif(a==3):
print("day is wednesday!")
elif(a==6):
print("day is saturday!")
elif(a==7):
print("day is sunday+funday!")
7 changes: 7 additions & 0 deletions if_else_12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
n=int(input("enter the month number :"))
if(n==1 or n==3 or n==5 or n==7 or n==8 or n==10 or n==12):
print("This is a month of 31 days!")
elif(n==2):
print("this is a month of 28 or 29 days!")
else:
print("This is a mont of 30 days!")
6 changes: 6 additions & 0 deletions if_else_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a=int(input("Enter the first number : "))
b=int(input("Enter the second number : "))
if(a<b):
print(b-a)
elif(b<a):
print(a-b)
7 changes: 7 additions & 0 deletions if_else_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a=int(input("Enter the number that you want to check : "))
if(a%5==0):
print("Number is devisible by 5")
elif(a%11==0):
print("Number is devisible by 11")
else:
print("Number is not devisible")
Loading

0 comments on commit 9f588bf

Please sign in to comment.