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

前端 未结 2 1789
一个人的身影
一个人的身影 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.)

    0 讨论(0)
  • 2021-01-28 12:19

    use raw_input(), input() doesn't work here

    Check out the tutorial on YouTube: http://www.youtube.com/watch?v=qsTdaxahTsM

    0 讨论(0)
提交回复
热议问题