May-12-2020, 12:22 PM
I'm completely brand new to Python and I've been learning on a cool course. I will put what I learn into this project i'm working on named SamBot. It's a very simple bot that asks you questions and says it likes your answers. Here is the code, just put it into a Python editor and run it, that's all you need. This is the first version. (There is an Easter Egg so please don't read the code until you've found it):
# Program starts by giving credit to the author import time print("SamBot, simple chatbot written by: Benjamin Nation") time.sleep(3) # First Sam asks the user's name and says he likes it print("Hi my name is SamBot!") time.sleep(2) userName = input("What's your name?") time.sleep(1) print("I love that name,", userName) time.sleep(2) # Then Sam asks what the user's favorite color is and responds that it's his favorite too userColor = input("What's your favorite color?") time.sleep(1) print(userColor, "is my favorite color too!") time.sleep(1) # Sam then asks what their favorite movie is then responds saying he likes their movies and another movie # out of a random list import random movieList = ["Harry Potter", "Hunger Games", "Onward", "Finding Nemo", "Ferngully", "Narnia"] userMovie = input("What is your favorite movie?") time.sleep(1) print("I love", userMovie, "and", random.choice(movieList), "is really good too") time.sleep(1) # Now, Sam asks the user what their favorite game is, this process will be similar to the movies gameList = ["Minecraft", "Fortnite", "Apex", "Gang Beasts", "Roblox", "Dauntless", "Untitled Goose Game"] userGame = input("What is your favorite game?") time.sleep(1) print(userGame, "is a really good game but I like", random.choice(gameList), "better") time.sleep(1) # Sam will ask the user's age and then give it back in days userAge = input("How old are you?") time.sleep(3) print("That's cool! Did you know you're also", int(userAge) * 365, "days old?") time.sleep(3) # Sam says his final goodbyes and asks if the user can speak with him again print("I guess this is goodbye, will you try to talk to me again?") goodbyeMessage = input("Y for yes and N for no") if goodbyeMessage == "Y": time.sleep(1) print("Yay! See you soon!") if goodbyeMessage == "N": time.sleep(5) print("Oh") time.sleep(5) print("Ok") time.sleep(5) print("Goodbye anyway") if goodbyeMessage == ("Easter Egg 001"): time.sleep(1) print("You worked hard enough to find my first Easter Egg! Good job! See you soon!") time.sleep(2) print("Time to go!") time.sleep(5)