Question again

af kh Ak.82009 at hotmail.com
Thu Sep 16 01:50:17 EDT 2021


Hello,
I was doing some coding on a website called replit then I extracted the file, and opened it in Python. For some reason, after answering 'no' or 'yes' after the last sentence I wrote, the Python window shut off, in replit I added one more sentence, but it isn't shown on Python, it just shuts off. Why is that? please reply to me soon since I need to submit it as an assignment for my class.

Code on replit:
#Title: Week 2: Chatbot with personality
#Author: Afnan Khan
#Date:9/15/21
#Description: Ask at least 3 questions to the user
#and create a creative topic

#Gives greetings to the user
import random

greetings = ["Hello, I'm Mr. ChatBot!", "Hi, I'm Mr. ChatBot!", "Hey~, I'm Mr. ChatBot!"]
comment = random.choice(greetings)
print(comment)
#Learn about the user's Name: First question
name = input("What is your name? ")

#Greet the User
print("Nice to meet you, " + name)

#Ask the user about their day: Second question
print("How is your day going? ")

#The user replies
reply = input()

#If user says 'amazing', reply with 'I am glad!'
if reply == "amazing" :
  print("I am glad!")

#If user says 'Alright', reply with 'that's good'
elif reply == "alright" :
  print("that's good")

#If user says 'bad', reply with 'Do not worry things will get better'
elif reply == "bad" :
  print("Do not worry things will get better")

#Else than that type 'I see'
else :
  print("I see!")

#Ask to pick between numbers 1~10 to see if you will get lucky today: Third question
number = input("Please pick between numbers 1~10 to see your luck for today: ")

#From number 1~3 and an answer
if number == "1" or number == "2" or number == "3" :
  print("You're in greeeeat luck today!")

#From number 4~7 and an answer
elif number == "4" or number == "5" or number == "6" :
  print("damn, bad luck is coming your way")

#From number 8~10 and an answer
elif number == "7" or number == "8" or number == "9" or number == "10" :
  print("I cannot sense any luck today, try again next time")

#Add a statement and question: Fourth question
print("That will be all for today's chitchat, woohooo! would you like to exit the chat?")

#User says 'yes'
reply = input()

#If user says 'yes' reply 'wait hold on! are you really leaving??': Fifth question
if reply == "yes" :
  print("Wait hold on! are you really leaving??")

#User answers
answer = input()

#If user says 'yes' again, reply 'fine! bye then!'
if answer == "yes" :
  print("Fine! bye then!")

#Other than that if user says 'no', reply 'just kidding we're done here haha'
elif answer == "no" :
  print("just kidding we're done here haha")


Regards,
Aya


More information about the Python-list mailing list