jeudi 22 janvier 2015

I'm struggling with some if statements - Python 2.7.9 (big noob)

I am wanting to make a portion of a game where you have a gun with only one bullet. But you have two chances to use it. so if you used it the first time u couldn't use it the second time, or vice versa.



ammo_amount = 1

ammo = raw_input ("Shoot?")
if ammo == 'y':
print ("you shot")
ammo_amount-1

else:
print("You didn't shoot")

ammo_2 = raw_input ("do you want to shoot again?")

if ammo_2 == 'y':
if ammo_amount == '1':
print ("you can shoot again")

if ammo_amount == '0':
print ("you can't shoot again")
if ammo_2 == 'n':
print ("You didn't shoot")

Aucun commentaire:

Enregistrer un commentaire