小编use*_*960的帖子

Python: Checking whether or not a variable is a int (using while loop)

just need a little help. Starting out doing python, trying to create a high score program and I want to say while score is not equal to an integer then ask user to input score.

For example (this doesn't work)

name = input("Please enter your name: ")
score = None
while score != int(score):
    score = input("Enter your score: ")
print("congratz it worked genius")
Run Code Online (Sandbox Code Playgroud)

thanks in advance

python-3.x

2
推荐指数
1
解决办法
7787
查看次数

标签 统计

python-3.x ×1