Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

syntax error except, python 3

[es] :: Python :: syntax error except, python 3

[ Pregleda: 2259 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

spredic
danbuga ltd :)
planeta zemlja

Član broj: 103900
Poruke: 202

Sajt: blog.predicsasa.com


+12 Profil

icon syntax error except, python 302.02.2013. u 10:28 - pre 136 meseci
opet pratim lekciju ali kad idem na run, izadje error syntax koji selektuje except:

Code:
try:
    a = int(input('First number: ',))
    b = int(input('Second number: '))
    print("Your result is ", a/b)
    except ZeroDivisionError:
        print('Error: Division by zero will not work.')


gde je greska?

isto mi pokazuje i kad dodam:

Code:
except (ZeroDivisionError, ValueError, TypeError) as e:
        print('Error: ', e')
 
Odgovor na temu

fimalbonegaculo
product development, team lead,
developer, sys-admin
beograd

Član broj: 395
Poruke: 161
*.ntlworld.ie.

ICQ: 81662016


+1 Profil

icon Re: syntax error except, python 302.02.2013. u 11:06 - pre 136 meseci
indentacija ti nije dobra:
Code:

try:
    a = int(input('First number: ',))
    b = int(input('Second number: '))
    print("Your result is ", a/b)
except ZeroDivisionError:
        print('Error: Division by zero will not work.')

"if you fail to plan, you plan to fail"
 
Odgovor na temu

spredic
danbuga ltd :)
planeta zemlja

Član broj: 103900
Poruke: 202

Sajt: blog.predicsasa.com


+12 Profil

icon Re: syntax error except, python 302.02.2013. u 11:31 - pre 136 meseci
e hvala :)
 
Odgovor na temu

[es] :: Python :: syntax error except, python 3

[ Pregleda: 2259 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.