Error in Phyton script

Asked

Viewed 115 times

0

I downloaded a script (I don’t know if this is how to say it, I’m starting programming today) of a game made in python but I can’t run it because there is an error

File "C: Users mah14 Desktop Bliblico.py Game", line 23 """; Syntaxerror: invalid syntax

If anyone can help me sort it out, I’d appreciate it

# *** JOGO BIBLICO *** Algoritmo de Abraao
# (Genesis 18:24-32)
# By Guilherme Jose Ferreira ([email protected])

# Inicio do programa
print ('\n'*100)
print """
# *** JOGO BIBLICO *** Algoritmo de Abraao
# By Guilherme Jose Ferreira ([email protected])

    Neste jogo voce deve convencer a Deus a nao destruir
    Sodoma e Gomorra (Genesis 18:24-32). Algo um tanto
    quanto muito dificil, mas vamos la:

    No prompt "Eu:" Digite:
    --> Senhor, e se houver xyz justos na cidade?
    (Onde 'xyz' corresponde a um numero entre 0 e 999)

    Lembre-se: Digite certo para acabar logo!

    Boa sorte!!!;
(""")
raw_input('\nTecle <ENTER> ')

# Inicio do jogo
print '\n'*100
numjust = 50
while numjust >= 10:
    justos = raw_input('Eu: ')
    try:
        if int(justos[20:23]) == numjust:
            print "Deus: Nao destruirei a cidade por amor dos",numjust,"justos."
            if numjust < 45:
                numjust -= 5
            numjust -= 5
    # Jogo do tipo "quente ou frio"
        elif int(justos[20:23]) > numjust:
            print "Deus: Voce nao deveria pedir por menos justos?"
        elif int(justos[20:23]) < numjust:
            print "Deus: Voce nao gostaria de pedir por mais justos?"
    # Se digitar errado, comeca tudo de novo
    except ValueError:
        print "Deus: Acaso vou destruir as cidades sem consultar Abraao?"
        numjust = 50
raw_input('\nTecle <ENTER> ')

# Fim do jogo
print '\n'*100
print "\nDeus: Anjos, tirem Lo e sua familia de la..."
print "\nAnjos: Sim, Senhor!"
print "\n\n*** GAME OVER!!! ***\n"
raw_input('\nTecle <ENTER> ')
  • 1

    You will need to [Edit] the question and add the code that generates the error. But already ahead will be well you study at least the basics before anything, including programming logic and Python documentation.

  • Anderson already added the code, and thanks for the tip

  • The code was written in Python 2, already tried to run in this version?

  • No, thanks for your help

1 answer

2

The code was written in Python 2, you can install Python 2 or make small modifications to the code to adapt it to Python 3. For example the error you are having in line 23 is because of the print. In Python 3 print() is a function, and needs to be used in parentheses. This (""") makes no sense. raw_input() does not exist in Python 3... and so on.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.