在Python中,如果你想输入多个数字,你可以使用以下方法:
1. 输入一个数字:
m = int(input())
2. 输入两个数字:
m, n = map(int, input().split())
3. 输入三个及三个以上数字:
a, b, c = map(int, input().split())
a, b, c, d = map(int, input().split())
你还可以使用`input()`函数接收用户输入,并使用`split()`方法将输入的字符串分割成多个数字,然后使用列表推导式将字符串转换为整数列表:
user_input = input("请输入多个数字,以空格分隔:")
numbers = [int(num) for num in user_input.split()]
print("输入的数字列表:", numbers)
如果输入的是小数,可以使用`float()`函数将字符串转换为浮点数。