Learning Python: If condition executing all the time

后端 未结 5 1552
情深已故
情深已故 2021-01-21 05:33

I am learning python and i can\'t figure out why the following program is printing your number is greater than what i thought even when the guessed number is sm

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-21 06:39

    raw_input will return a string. You need to parse it into a number for the compare to work properly. I think that's just int(raw_input(...))

提交回复
热议问题