Python not finding item in list

后端 未结 2 1330
旧时难觅i
旧时难觅i 2021-01-27 08:34

I am just trying out some basic functionality in Python, and this is the entire script that I wrote:

a = [5, 3, 6, 9, 7, 8]
x = input()
print(x in a)
         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-27 09:22

    Cast the input to int. input() always returns a string

    x = int(input())
    

提交回复
热议问题