Receive a string, convert to calculate and display response, but.. Can't split

前端 未结 2 1788
一个人的身影
一个人的身影 2021-01-28 11:41

My homework question:

Create a script to receive the birth date and return the user\'s age

I tried this:

ano_atual =         


        
2条回答
  •  清酒与你
    2021-01-28 12:09

    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.)

提交回复
热议问题