Feb-03-2018, 09:36 AM
So I'm learning to program and started with python. I'm training doing a simple rpg game.
Almost all functions use if-else. But one of them does not work.
The console says syntax error and points to the ":"
This is what does not work (I'm Brazilian, only this part is in English for better answers here)
Almost all functions use if-else. But one of them does not work.
The console says syntax error and points to the ":"
This is what does not work (I'm Brazilian, only this part is in English for better answers here)
def fight(): print("You need to choose where look for enemies.Has the 'Cave'") global JJ JJ = (input("Where loook?") if JJ == "Cave": print ('Cachaca') else: print('AAAAAAA')and that is everything else
import random print ("Feito por Vinicius Perrud") print ("Primeiro vamos escolher sua classe, se voce quiser guerreiro digite 1, se quiser arqueiro digite 2") classe = int(input("Qual classe voce quer ?")) if classe == 1: armas = 1 else: armas = 2 gold = 100 if classe == 1: vida = 20 dano = [0,5] else: vida = 15 dano = [0,11] #def commands(): print('nothing') def commands(): print ("Comandos disponiveis sao '1'(loja), '2'(fight), '3'(status).") e = int((input("Comando escolhido: "))) if e == 1: shop() elif e==2: luta() else: status() def shop (): print ("Comandos na loja sao '1' (aumenta a vida por 10 de gold), '2' (comprar armas por 10 de gold) e 3(exit)") e = int((input("Comando escolhido: "))) if e == 1: if gold >= 10: global gold gold = gold - 10 global vida vida = vida + 15 commands() else: commands() elif e == 2: if gold >= 10: global gold gold = gold - 10 global dano d = (dano [1]) + 15 dano [1] = d commands() else: commands() def status(): print("""Vida: {} Dano: {} Gold: {}""".format(vida,dano,gold)) commands() def luta(): print("You need to choose where look for enemies.Has the 'Cave'") global JJ JJ = (input("Where loook?") if JJ == "Cave": print (l) else: print('AAAAAAA') commands() #print (random.triangular(min,max))