Skip to content
Open
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
19 changes: 19 additions & 0 deletions Accept Student marks out of 100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#By-Tuhin
suba=int(input("Enter Subject 1 marks:"))
subb=int(input("Enter Subject 2 marks:"))
subc=int(input("Enter Subject 2 marks:"))

if suba>100:
print("Subject 1 marks exceding 100")

if subb>100:
print("Subject 2 marks exceding 100")

if subc>100:
print("Subject 3 marks exceding 100")

if suba>100 or subb>100 or subc>100:
print("Try again")

else:
print("You got", suba+subb+subc, "out of 300 in all subject")
12 changes: 12 additions & 0 deletions Ar(Square or Triangle).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
print("1.Calculate Area of Square")
print("2.Calculate Area of Triangle")
choice=int(input("Enter your Choice(1 or 2):"))
if choice==1:
side=float(input("Enter length of side:"))
print("Area of Square=", side**2)
elif choice==2:
base=float(input("Enter length of Base:"))
height=float(input("Enter length of Height:"))
print("Area of Triangle=", 1/2*base*height)
else:
print("Wrong Choice....\nTry Again")
5 changes: 5 additions & 0 deletions Calculate Simple Intrest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
p=float(input("Enter Principle Amount:"))
r=float(input("Enter Rate of Intrest:"))
t=float(input("Enter Time Period:"))
SI=p*r*t/100
print("Simple Interest=", SI)
5 changes: 5 additions & 0 deletions Check Odd or Even.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a=int(input("Enter a number:"))
if a%2==0:
print(a, "is an even number")
else:
print(a, "is an odd number")
10 changes: 10 additions & 0 deletions Find the largest no. bwt three no..py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
c=int(input("Enter third number:"))
if a>=b and a>=c:
largest=a
elif b>=c and b>=a:
largest=b
else:
largest=c
print("The largest number between", a, ",", b, "and", c, "is", largest)
11 changes: 11 additions & 0 deletions Library Management System/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

</body>
</html>
59 changes: 59 additions & 0 deletions Library Management System/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
class Library:
def __init__(self, listOfBooks):
self.books = listOfBooks

def displayAvailableBooks(self):
print("Books present in this library are: ")
for book in self.books:
print(" *" + book)

def borrowBook(self, bookName):
if bookName in self.books:
print(f"You have been issued {bookName}. Please keep it safe and return it within 30 days")
self.books.remove(bookName)
return True
else:
print("Sorry, This book is either not available or has already been issued to someone else. Please wait until the book is available")
return False

def returnBook(self, bookName):
self.books.append(bookName)
print("Thanks for returning this book! Hope you enjoyed reading it. Have a great day ahead!")

class Student:
def requestBook(self):
self.book = input("Enter the name of the book you want to borrow: ")
return self.book

def returnBook(self):
self.book = input("Enter the name of the book you want to return: ")
return self.book


if __name__ == "__main__":
centraLibrary = Library(["Algorithms", "Django", "Clrs", "Python Notes"])
student = Student()
# centraLibrary.displayAvailableBooks()
while(True):
welcomeMsg = '''\n ====== Welcome to Central Library ======
Please choose an option:
1. List all the books
2. Request a book
3. Add/Return a book
4. Exit the Library
'''
print(welcomeMsg)
a = int(input("Enter a choice: "))
if a == 1:
centraLibrary.displayAvailableBooks()
elif a == 2:
centraLibrary.borrowBook(student.requestBook())
elif a == 3:
centraLibrary.returnBook(student.returnBook())
elif a == 4:
print("Thanks for choosing Central Library. Have a great day ahead!")
exit()
else:
print("Invalid Choice!")


6 changes: 6 additions & 0 deletions Print Quotient and Remainder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
divisor=float(input("Enter Divisor:"))
dividend=float(input("Enter Dividend:"))
quotient=dividend/divisor
remainder=dividend%divisor
print("Quotient=", quotient)
print("Remainder=", remainder)
51 changes: 51 additions & 0 deletions Snake, Water, Gun Game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import random

# Snake Water Gun or Rock Paper Scissors
def gameWin(comp, you):
# If two values are equal, declare a tie!
if comp == you:
return None

# Check for all possibilities when computer chose s
elif comp == 's':
if you=='w':
return False
elif you=='g':
return True

# Check for all possibilities when computer chose w
elif comp == 'w':
if you=='g':
return False
elif you=='s':
return True

# Check for all possibilities when computer chose g
elif comp == 'g':
if you=='s':
return False
elif you=='w':
return True

print("Comp Turn: Snake(s) Water(w) or Gun(g)?")
randNo = random.randint(1, 3)
if randNo == 1:
comp = 's'
elif randNo == 2:
comp = 'w'
elif randNo == 3:
comp = 'g'


you = input("Your Turn: Snake(s) Water(w) or Gun(g)?")
a = gameWin(comp, you)

print(f"Computer chose {comp}")
print(f"You chose {you}")

if a == None:
print("The game is a tie!")
elif a:
print("You Win!")
else:
print("You Lose!")
1 change: 1 addition & 0 deletions The Perfect Guess/hiscore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
24 changes: 24 additions & 0 deletions The Perfect Guess/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import random
randNumber = random.randint(1, 100)
userGuess = None
guesses = 0

while(userGuess != randNumber):
userGuess = int(input("Enter your guess: "))
guesses += 1
if(userGuess==randNumber):
print("You guessed it right!")
else:
if(userGuess>randNumber):
print("You guessed it wrong! Enter a smaller number")
else:
print("You guessed it wrong! Enter a larger number")

print(f"You guessed the number in {guesses} guesses")
with open("hiscore.txt", "r") as f:
hiscore = int(f.read())

if(guesses<hiscore):
print("You have just broken the high score!")
with open("hiscore.txt", "w") as f:
f.write(str(guesses))
1 change: 1 addition & 0 deletions The Perfect Guess/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5