【发布时间】:2018-01-07 01:16:14
【问题描述】:
我正在编写一个程序,它要求用户输入一个数字,我需要确保该数字是实际数字而不是字符串。这个数字可以是正数或负数。我尝试过使用 .isnumerical() 和 .isdigit() 但它们除了负数之外不会。
lowest_num = input("What would you like the lowest possible number to be?")
while lowest_num.isdigit() is not True:
lowest_num = (input("Please only enter a number : ")).lower()
提前感谢您的帮助
【问题讨论】:
标签: python-3.6