python bots

#I'm assuming that people would like a chatbot: Here is an example of one that tells an adventure story.
#Feel free to make any changes.
#I'm not going to write out a completed bot, by the way.


#Importing the time and random modules.
import random
import time 

#Setting the counters.
choices=0
incorrect=1
incorrect1=1
incorrect2=1

#Asking the User's name.
print ("Welcome user. What is your name?")
cname = input()
print ("Before we start, I have to explain the rules to you.")
print ("This adventure game has multiple endings depending on what cycles of commands you choose to go through. Whenever your input is required, options will be displayed on the screen. Please choose one of the options and enter it in.")
time.sleep(6.5)

#Introduces the story of the game, sets the theme and gives the user their first choice on where to go.
print ("\n")
print ("You wake up in a dark cave")
print ("You don't remember going to sleep in here...")
time.sleep(2)
print ("You're thinking about how you could've gotten here and what to do next when all of a sudden...")
time.sleep(2.5)
print ("*", cname, ",", cname, ",", cname, ",", cname, "*" " You hear a voice whisper your name and it bounces off the cold, inky black walls"" *", cname, ",", cname, ",", cname,", *" )
print ("\n")
time.sleep (4)
print ("Do you, (A) Get up and attempt to discover the source of the whispering?""\n""(B) Stay where you are and not move a muscle for fear of being discovered?"
"\n""(C) Get up and run as far away from the whispering as possible?")
choice1=input()

if choice1=="A" or choice1=="a":
    print ("\n")
    print ("You venture deep into the caverns and press along the dark and suprisingly.. soft walls.")
    time.sleep(3)
    print ("After many cuts and soft curses from the many sharp extrusions in the wall, you come across a mossy vined section of the wall.")
    time.sleep(4)
    print ("You look up and notice a faint white light hundreds of feet above which appears to be the source of the whispering, and the only way up, appears to be the treacherous vined wall...")
    time.sleep(5)
    print ("Do you wish to (A) try your luck on the treacherous vines or (B) keep looking for another way?")
    choice1a=input()

    if choice1a=="A" or choice1a=="a":
        print ("\n")
        print ("Many near death expeiences and torn soles later you crawl up onto the ledge.")
        time.sleep(3)
        print ("The whispering suddenly ceases and the burning light parts to reveal a shadowy creature standing there...")
        time.sleep(4.5)
        print ("Well well, an adventurous one, welcome to my cave of riddles, its scratchy voice whispered.")
        time.sleep(4)
        print ("Im feeling merciful today so how about you either (A) get a riddle with one guess to try and solve it or (B) have 5 tries to guess a number from 1-10? \nIf you win, you live, and if you lose, you die!")
        choice1b=input()

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source