Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
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
34 changes: 34 additions & 0 deletions Guessing_number_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import random as rd
s="*"*10
i=1
print(s,"welcome to number guessing game",s)
print("computer is ready to choose a number")
C=rd.randint(1,100)

print("Are you ready to guess that number")
print("if yes \n Enter 1 \n if No \n Enter 2")
x=int(input())
if x==1:
print("NOTE: you have only 5 chances to guess the number")
print("ALL THE BEST!!!")
while i<=5:
y=int(input("enter your number"))
if C==y:
print(s,"Hurray!!! you got the number",s)
i==5
elif C>y:
print("You guessed a number which is less than the Computer number")
i+=1
elif C<y:
print("You guessed a number which is greater than the Computer number")
i+=1
else:
print("Entered a number which is out the range!!!")
print("THE RANGE OF THE NUMBERS TO GUESS IS FROM 1 TO 100")
i+=1

else:
print("you reached your maximum limit!!!")
print("The number generated by the computer is",C)
else:
print("We will play next time!!\n\n THANK YOU!!!")
45 changes: 45 additions & 0 deletions PDF_TO_DIFFERENT_FORMATS_CONVERTER.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import PyPDF2
import fitz # PyMuPDF
from docx import Document
from PIL import Image
from docx.shared import Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT

def pdf_to_image(pdf_path, image_path):
pdf_document = fitz.open(pdf_path)
for page_number in range(len(pdf_document)):
page = pdf_document[page_number]
image = page.get_pixmap()
image.save(f"{image_path}_page_{page_number + 1}.png")

def pdf_to_text(pdf_path, text_path):
with open(pdf_path, 'rb') as file:
reader = PyPDF2.PdfReader(file)
text = ''
for page_number in range(len(reader.pages)):
text += reader.pages[page_number].extract_text()

with open(text_path, 'w', encoding='utf-8') as text_file:
text_file.write(text)

def text_to_document(text_path, doc_path):
document = Document()
with open(text_path, 'r', encoding='utf-8') as text_file:
for line in text_file:
paragraph = document.add_paragraph(line.strip())
paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.LEFT
run = paragraph.runs[0]
run.font.size = Pt(12) # Set font size to 12pt (adjust as needed)
# You can add more formatting options here

document.save(doc_path)

# Example usage
pdf_file = r"C:\Users\DELL\Downloads\kavya junuthula (3).pdf"
image_output_path =r"C:\Users\DELL\Downloads"
text_output_path=r"C:\Users\DELL\textfile.txt"
doc_output_path =r"C:\Users\DELL\document.docx"

pdf_to_image(pdf_file, image_output_path)
pdf_to_text(pdf_file, text_output_path)
text_to_document(text_output_path, doc_output_path)
37 changes: 37 additions & 0 deletions simple_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
def add(x,y):
return x+y
def sub(x,y):
return x-y
def mul(x,y):
return x*y
def div(x,y):
return x/y
def moddiv(x,y):
return x%y
print("ENTER 1.ADDITION \n\n 2.SUBTRACTION \n\n 3.MULTIPLICATION \n\n 4.DIVISION \n\n 5.MODULUS_DIVISION\n\n 6.EXIT\n\n")
#ch=int(input("Enter Your Choice:"))
n=int(input("enter no of operations you want to do:").upper())
for i in range(1,n+1):
ch=int(input("Enter Your Choice:"))
if ch==1:
x=int(input("enter x value:").capitalize())
y=int(input("enter x value:").capitalize())
print("THE SUM OF",x,"AND",y,"IS",add(x,y))
elif ch==2:
x=int(input("enter x value:").capitalize())
y=int(input("enter x value:").capitalize())
print("THE SUBTRACTION OF",x,"AND",y,"IS",sub(x,y))
elif ch==3:
x=int(input("enter x value:").capitalize())
y=int(input("enter x value:").capitalize())
print("THE MULTIPLICATION OF",x,"AND",y,"IS",mul(x,y))
elif ch==4:
x=int(input("enter x value:").capitalize())
y=int(input("enter x value:").capitalize())
print("THE DIVISION OF",x,"BY",y,"IS",div(x,y))
elif ch==5:
x=int(input("enter x value:").capitalize())
y=int(input("enter x value:").capitalize())
print("THE MODDIVISON OF",x,"AND",y,"IS",moddiv(x,y))
else:
exit()