Learning Python: If condition executing all the time

后端 未结 5 1506
情深已故
情深已故 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:35

    I think this is because raw_input is considered a string, so Python assigns it a value based on the char values. Try writing int(raw_input("text")) and see if it solves your problem.

提交回复
热议问题