Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
Farooqm10 committed Mar 20, 2020
1 parent 6b8cb69 commit 9bcfa37862b12d9e63545620a4643605193feb83
Showing 1 changed file with 114 additions and 0 deletions.
@@ -0,0 +1,114 @@
################### This code was done by Musharof Husan Munna ######################

import time
#Imported requests library to for making HTTP requests to the API
import requests

name = input("Hello, What is your name?: ")
time.sleep(1)
print("Hello " + name + "!" + " You alright? I am your module's query chatbot!")
time.sleep(1)
print("How can I help you? These are the things I can do!")

def chooseOptions():
listOfThings = ["1) Telling the room numbers of your lessons" , "2) Counting the days left before your next assessment", "3) Cracking some jokes. Well only if you want to laugh"]
print("1) Telling the room numbers of your lessons.\n2) Counting the days left before your next assessment.\n3) Cracking some jokes. Well only if you want to laugh")
for y in listOfThings:
x = input("Type the number: ")
x = int(x)

if x == 1:
time.sleep(1)
print("I can do that!")
time.sleep(1)

listOfRooms = {
1: "ECG-26",
2: "EC1-01",
3: "ETG-34",
4: "EC2-12",
5: "ECG-27",
6: "ECG-27",
7: "ECG-03"
}

time.sleep(.5)
print("1) 4000CEM - Programming and Algorithms\n2) 4000CEM - Programming and Algorithms/LAB\n3) 4004CEM - Computer Architecture and Networks\n4) 4004CEM - Computer Architecture and Networks/LAB\n5) 4005CEM - Database Systems\n6) 4005CEM - Database Systems/LAB\n7) 4006CEM - Computer Science Activity Led Learning Project 1")
chooseRooms = input("Type a number: ")
chooseRooms = int(chooseRooms)
x = listOfRooms[chooseRooms]
print("Your room number is " + x)
time.sleep(1)
print("Anything else you want? Like... ")
time.sleep(0.5)
print("1) Telling the room numbers of your lessons.\n2) Counting the days left before your next assessment.\n3) Cracking some jokes. Well only if you want to laugh")
############Days left before the assessment part's code########################
elif x == 2:
print("Mmm.. Can do that. I wonder what date it is today! I don't wear watch. Can you please...")
mList = {
1:"January",
2:"February",
3:"March",
4:"April",
5:"May",
6:"June",
7:"July",
8:"August",
9:"September",
10:"October",
11:"November",
12:"December"

}
date = input("Type the Month (MM): ")
date = int(date)
time.sleep(1)
print("Thank you! My turn to return your help!")
time.sleep(1)
print("Counting days ....")
time.sleep(1)
print("Ahh.. Got it. ")
time.sleep(0.8)
x = mList[date]
x = str(x)

if x == "March":
print("And what day it is?")
time.sleep(0.8)
currentDate = input("Type day (DD): ")
currentDate = int(currentDate)
if currentDate <= 11:
y = int(11 - currentDate)
if y==0:
print("It's your assessment day!")
else:
print("You got " + str(y) + " days left!")
elif currentDate > 11 and currentDate <= 20:
y = int(20-currentDate)
print("You got " + str(y) + " days left!")
elif currentDate > 20 and currentDate <= 27:
y = int(27-currentDate)
print("You got " + str(y) + " days left!")
elif x == "April":
currentDate = input("DD: ")
currentDate = int(currentDate)
if currentDate <= 6:
y = int(6-currentDate)
print("You got " + y + " days left!")
elif currentDate > 6 and currentDate <= 14:
y = int(14-currentDate)
print("You got " + str(y) + " days left!")
else:
print("No assessments in the current month!")
######################################################################################################################
###############API was used to collect huge number of random jokes ######################################################
###############The API code's documentation was in curl command which I converted into python requests library
#Because it seems a bit easier to me... ###################################################################################
elif x==3:
headers = {'Accept': 'text/plain',}
response = requests.get('https://icanhazdadjoke.com/', headers=headers)
print(response.text)
else:
print("Didn't figure that out yet!")
chooseOptions()

0 comments on commit 9bcfa37

Please sign in to comment.