Python Forum
Need a little more help in a Choose Your Own Adventure Program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a little more help in a Choose Your Own Adventure Program
#11
But how do you make an else statement do two things?
Nevermind I figured out how
Reply
#12
The computer says that when I say maximum_amount * .2, it gives no effect, why is this.
Thanks-Goldberg291

import random
import sys
import time
maximum_amount = 250,000
end_maximum_amount = maximum_amount=-40,000
members={'harry':'10%','chris':'20%','ben':'20%','septiums':'10%','amelia':'20%','jenna':'10%','beetle':'20%','marsha':'10%'}

name = input('Enter your name: ')
print("Hello",name)
answer_1=input('Would you like to play choose your own adventure?: ')
if answer_1=='yes':
    print('Okay lets get started')
elif answer_1 == 'no':
    print("Ugh")
    sys.exit()
answer_2 = input('\nYour name is {} and you live on planet Xeno.  You are hoping to save up for the new Toto2000, the best and newest spaceship there is, but you know there is only one way to get that spaceship because it is too expensive.\n  \nYou either have to rob and steal from the bank of Xeno or work for the rest of your life and try to afford the spaceship at the end of your life.\n  \nType 1 to start planning to rob the bank or enter 2 to work for the rest of your life.\n'.format(name))
if answer_2=='1':
    print('Now you need to start planning for your hiest at Xeno bank.')
elif answer_2=='2':
    print('Thats lame', name)
    sys.exit()
elif answer_1=='no':
    print('\nOkay thank you for your time.\n')
print( '\nFirst you must get a crew for your hiest, you need five people to help you in your hiest.\n \nOne person to drive your getaway hover vechile, one person that can pick locks very well,\n \nOne person that has experience with the high powered drill, and you and one other person will be making sure that no one walks into or by the bank by pretending to be police officers.\n')
time.sleep(13)
print('\nThere are two options for every job and you must decide who you want, but remember the better person that you choose the less money you will get.\nThe Toto200 costs $40,000.\nThe bank holds $250,000.\nIf a task goes wrong you and your gang wont be able to steal as much money. ')
# The next line is going to be your descion on what driver you want
time.sleep(13)
answer_3=input('Your first decsion is to decide who you want to be driving your getaway hover vehicle.  You can either choose Chris which is the better person at driving or you can choose Harry which is worse.  If you choose Chris is pay cut will be 20% but if you choose Harry his pay cut will be 10%.  Type chris or harry')
if answer_3 in ['harry', 'chris']:
    print("You chose {}, your next descion is going to be who you will choose as your locksmith".format(answer_3))
    time.sleep(5)
# The next line will be who you choose for the locksmith.
answer_4=input('You can either choose ben who is better but has a 20% cut or you can choose septimus who is worse but has a 10% cut enter ben or septimus')
if answer_4 in ['ben', 'septimus']:
    print('You chose {}, next you will be choosing who will be operating the drill.'.format(answer_4))
    time.sleep(5)
# Next you will be choosing who operates the drill
answer_5=input("You can either choose Amelia who is better but 20% cut or Jenna who has a 10% cut.  Type jenna or amelia.")
if answer_5 in ['amelia','jenna']:
    print("You chose {}, next you will need to choose who you want to be a police officer with you.".format(answer_5))
    time.sleep(5)
# Next you will be choosing who is the other police officer
answer_6=input("You can either choose beetle who is better but has a 20% cut or you can choose Marsha who has a 10% cut.  Type beetle or marsha.")
if answer_6 in ['beetle','marsha']:
  print("You chose {}, you are ready to do the hiest.".format(answer_6))
  time.sleep(5)
# Next will be the results for all 20%
# Keeping civilians away
if answer_6=='beetle':
    maximum_amount * .2
    if random.randrange(1,101) < 80:
        print('Beetle and you have successfully kept all civilians away from the bank by pretending to be police!')
    else:
        print('Oh no!  Beetle has failed to keep Civilians away and has called the police, which gives you less time to collect money!  You lose $15,000 of your total amount')
        maximum_amount=-15,000

time.sleep(3)
# Locksmith
if answer_4=='ben':
    maximum_amount * .2
    if random.randrange(1,101)<80:
        print("Ben has succeeded in picking the lock into the bank")
    else:
        print("Oh no! Ben has failed to pick the lock, it takes him 3 tries to pick the lock, which gives you less time to gather money!  You lose $15,000 of your total amount!")
        maximum_amount=-15,000
time.sleep(3)
# Drill
if answer_5=='amelia':
    maximum_amount * .2
    if random.randrange(1,101)<80:
        print('Amelia has succeeded in drilling the whole into the vault.')
    elif random: print('Oh no!  Amelia has failed drilling into the vault, it takes her 3 tries to get into the vault, which gives you less time to collect money!  \nYou lose $15,000 of your total amount!\n')
    maximum_amount=-15,000
time.sleep(3)
    # Driver
if answer_3=='chris':
    maximum_amount * .2
    if random.randrange(1,101) < 80:
        print('Chris succeeded in driving you away')
    else: print('Chris has failed to drive your team away, your gang must walk and drop some of your load off!  You lose $15,000 of your total amount!')
    maximum_amount=-15,000
time.sleep(3)

# Next will be the results for all 10%
if answer_6=="marsha":
    maximum_amount * .1
    if random.randrange(1,101)>40:
        print('Marsha has failed to keep away civilians, the police have been called, which gives you and your gang less time to collect money.  You lose $30,000 of your total amount!')
        maximum_amount =- 30,000
    else: print('Marsha has succedeed in keeping away civilians')
time.sleep(3)
if answer_4=='septimus':
    if random.randrange(1,101)<40:
        print('Oh No! Septimus has failed to pick the lock, it takes him an extra 3 times, which gives you and your gang less time to collect money!  You lose $30,000 of your total amount!')
        maximum_amount = -30,000
    else: print('Septimus has succeeded in picking the lock into the bank!')
time.sleep(3)
if answer_5=='jenna':
    maximum_amount * .1
    if random.randrange(1,101)<40:
        print('Oh No! Jenna has failed to drill into the vault, it takes her 3 tries to drill into the vault, which gives you and your gang less time to collect money!  You lose $30,000 of your total amount!')
        maximum_amount = -30,000
    else: print('Jenna has succeeded in drilling into the vault!')
time.sleep(3)

if answer_3=='harry':
    maximum_amount * .1
    if random.randrange(1,101)<40:
        print('Oh No! Harry has failed to drive you and your gang away, you and your gang must drop some of your load and walk!  You lose $30,000 of your total amount!')
        maximum_amount = -30, 000
    else: print('Harry has succeeded in getting the gang away!')
time.sleep(3)
if maximum_amount>=(40,000):
    print("You have finished your hiest and had enough money to buy the Toto2000 with","$" + end_maximum_amount, "left")
elif maximum_amount<(40,000):
    print("You have completed the hiest but you dont have enough money to buy the Toto2000")
Reply
#13
Because you haven't assigned it to a variable using the assignment operator (=). Also note that

maximum_amount = -30,000
doesn't subtract 30000 from maximum_amount, it assigns a new value to maximum_amount. It doesn't even assign -30000 to maximum_amount.

I really think you should find a good beginner's Python tutorial, maybe the one at python.org, and work your way through it.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#14
Aren't you confusing the comma and the decimal point?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mac os choose file name howard687 1 1,858 Jan-05-2022, 06:54 AM
Last Post: Larz60+
  Loop with choose Irv1n 5 3,226 Sep-16-2021, 09:31 PM
Last Post: deanhystad
  loop adventure game ilikedofs 1 1,699 May-26-2021, 12:43 AM
Last Post: bowlofred
  Choose an element from multidimensional array quest_ 2 2,620 Nov-25-2020, 12:59 AM
Last Post: quest_
  Need help implmenting if/else or case statements for option to choose file format. samlee916 1 2,004 Jul-22-2020, 06:06 PM
Last Post: Larz60+
  Choose your own adventure game noahc2004 2 2,571 Jun-26-2020, 02:06 PM
Last Post: DPaul
  Please help a newbie choose which programming language to learn. yeto 2 3,490 Feb-25-2019, 12:56 AM
Last Post: yeto
  Waiting in a text adventure StickyLizard 1 40,971 Jan-19-2019, 10:45 PM
Last Post: ichabod801
  User Input to Choose from Dictionary anelliaf 9 25,752 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  Reasons to choose Python over C++? RandoomDude 62 45,200 May-03-2017, 05:29 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020