Receive A String, Convert To Calculate And Display Response, But.. Can't Split
My homework question: Create a script to receive the birth date and return the user's age I tried this: ano_atual = 2012 data_nascimento =
Solution 1:
You probably want raw_input instead of input. input
is equivalent to eval(raw_input())
in python2.x. So your string is being cast to an integer. just like:
a=30/6/2012
would be. (In this case, a
is the result of 30 divided by 6 divided by 2012 which is 0 because of integer division in python 2.)
Solution 2:
use raw_input()
, input()
doesn't work here
Check out the tutorial on YouTube: http://www.youtube.com/watch?v=qsTdaxahTsM
Post a Comment for "Receive A String, Convert To Calculate And Display Response, But.. Can't Split"