From 5057cf2daf94e10095298c44e582269dab4172a5 Mon Sep 17 00:00:00 2001
From: Tuhin <64925748+tuhingarai@users.noreply.github.com>
Date: Wed, 30 Sep 2020 23:43:14 +0530
Subject: [PATCH 1/2] Add files via upload
---
Accept Student marks out of 100.py | 19 +++++++++
Ar(Square or Triangle).py | 12 ++++++
Calculate Simple Intrest.py | 5 +++
Check Odd or Even.py | 5 +++
Find the largest no. bwt three no..py | 10 +++++
Library Management System/index.html | 11 +++++
Library Management System/main.py | 59 +++++++++++++++++++++++++++
Print Quotient and Remainder.py | 6 +++
8 files changed, 127 insertions(+)
create mode 100644 Accept Student marks out of 100.py
create mode 100644 Ar(Square or Triangle).py
create mode 100644 Calculate Simple Intrest.py
create mode 100644 Check Odd or Even.py
create mode 100644 Find the largest no. bwt three no..py
create mode 100644 Library Management System/index.html
create mode 100644 Library Management System/main.py
create mode 100644 Print Quotient and Remainder.py
diff --git a/Accept Student marks out of 100.py b/Accept Student marks out of 100.py
new file mode 100644
index 0000000..4431c51
--- /dev/null
+++ b/Accept Student marks out of 100.py
@@ -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")
\ No newline at end of file
diff --git a/Ar(Square or Triangle).py b/Ar(Square or Triangle).py
new file mode 100644
index 0000000..601540b
--- /dev/null
+++ b/Ar(Square or Triangle).py
@@ -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")
\ No newline at end of file
diff --git a/Calculate Simple Intrest.py b/Calculate Simple Intrest.py
new file mode 100644
index 0000000..6176168
--- /dev/null
+++ b/Calculate Simple Intrest.py
@@ -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)
\ No newline at end of file
diff --git a/Check Odd or Even.py b/Check Odd or Even.py
new file mode 100644
index 0000000..8108483
--- /dev/null
+++ b/Check Odd or Even.py
@@ -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")
\ No newline at end of file
diff --git a/Find the largest no. bwt three no..py b/Find the largest no. bwt three no..py
new file mode 100644
index 0000000..8403661
--- /dev/null
+++ b/Find the largest no. bwt three no..py
@@ -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)
\ No newline at end of file
diff --git a/Library Management System/index.html b/Library Management System/index.html
new file mode 100644
index 0000000..59d753d
--- /dev/null
+++ b/Library Management System/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Document
+
+
+
+
+
\ No newline at end of file
diff --git a/Library Management System/main.py b/Library Management System/main.py
new file mode 100644
index 0000000..b80b332
--- /dev/null
+++ b/Library Management System/main.py
@@ -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!")
+
+
diff --git a/Print Quotient and Remainder.py b/Print Quotient and Remainder.py
new file mode 100644
index 0000000..9ab6b2f
--- /dev/null
+++ b/Print Quotient and Remainder.py
@@ -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)
\ No newline at end of file
From eb451c0f2447c37675555ae30adefb63ebb61f00 Mon Sep 17 00:00:00 2001
From: Tuhin <64925748+tuhingarai@users.noreply.github.com>
Date: Thu, 1 Oct 2020 00:08:29 +0530
Subject: [PATCH 2/2] Add files via upload
---
Snake, Water, Gun Game.py | 51 +++++++++++++++++++++++++
The Perfect Guess/hiscore.txt | 1 +
The Perfect Guess/main.py | 24 ++++++++++++
The Perfect Guess/tempCodeRunnerFile.py | 1 +
4 files changed, 77 insertions(+)
create mode 100644 Snake, Water, Gun Game.py
create mode 100644 The Perfect Guess/hiscore.txt
create mode 100644 The Perfect Guess/main.py
create mode 100644 The Perfect Guess/tempCodeRunnerFile.py
diff --git a/Snake, Water, Gun Game.py b/Snake, Water, Gun Game.py
new file mode 100644
index 0000000..6835a41
--- /dev/null
+++ b/Snake, Water, Gun Game.py
@@ -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!")
\ No newline at end of file
diff --git a/The Perfect Guess/hiscore.txt b/The Perfect Guess/hiscore.txt
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ b/The Perfect Guess/hiscore.txt
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git a/The Perfect Guess/main.py b/The Perfect Guess/main.py
new file mode 100644
index 0000000..4d827ce
--- /dev/null
+++ b/The Perfect Guess/main.py
@@ -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