Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatBot/times.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (37 sloc)
1.9 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import modules | |
import time | |
import webbrowser | |
import calendar | |
def calendar_reminder(what): | |
if "calendar" in what: | |
#Python Calendar to display given months in a year or whole year | |
#Allows user to select what they want the calendar to do | |
yom = input("Would you like the whole year or one month?").lower() | |
if "month" in yom: | |
print("Please enter as numbers ") | |
year = int(input("What year will you like? ")) | |
month = int(input("What month would you like? ")) | |
#display the calendar | |
print(calendar.month(year, month)) | |
if "year" in yom: | |
year = int(input("What year will you like? ")) | |
#Display the calendar | |
print(calendar.calendar(year)) | |
if "reminder" in what: | |
#Wakeup alarm type function | |
#takes a given time input and compares it to the current time | |
#if the two times are equal it opens a youtube lin k and starts to play an alarm video | |
#and displays wakeup in the python terminal | |
wakeup = input("What time do you want to wake up? \n Write in the form 'hh:mm' : ") | |
#converts datetime to a string | |
Time = time.strftime("%H:%M") | |
while Time != wakeup: | |
Time = time.strftime("%H:%M") | |
if Time == wakeup: | |
print("__ __ _ _ _ _ \n\ \ / /_ _| | _____ | | | |_ __ | | \n \ \ /\ / / _` | |/ / _ \ | | | | '_ \ | |\n \ V V / (_| | < __/ | |_| | |_) | |_|\n \_/\_/ \__,_|_|\_\___| \___/| .__/ (_)\n |_|") | |
#webrowser opens the youtube link given to it and the alarm begins to play | |
webbrowser.open("https://www.youtube.com/watch?v=lZ4n46lEWgU") | |
else: | |
print("") | |
what = str(input("What would you like to do? View calendar? or set Reminder? ")).lower() | |
calendar_reminder(what) |