Maçãs Posted July 19, 2013 at 04:37 PM Report #519404 Posted July 19, 2013 at 04:37 PM (edited) Boas, não estou a conseguir utilizar o and neste pequeno programa, qual é o erro? input('ano bissexto') a=eval(input('ano')) if a%4=0 and a%100!=0: input('ano bissexto') else: input('não bissexto') Edited July 19, 2013 at 04:50 PM by thoga31 GeSHi
Helio13 Posted July 19, 2013 at 04:44 PM Report #519406 Posted July 19, 2013 at 04:44 PM Primeiro no teu if devia estar if a%4==0 and a%100!=0: input('ano bissexto') else: input('não bissexto') ou não!? não te dá erro apenas com um = ?
Maçãs Posted July 19, 2013 at 04:47 PM Author Report #519407 Posted July 19, 2013 at 04:47 PM distração minha, claro que assim já dá. Obrigado
thoga31 Posted July 19, 2013 at 04:52 PM Report #519408 Posted July 19, 2013 at 04:52 PM Não devias usar eval, mas sim int. eval executa código Python e deve ser utilizado noutras situações. a = int(input()) De seguida, na estrutura IF, não queres antes fazer um print? Não entendo o propósito daqueles input's. Knowledge is free!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now