number=int(input("Input a positive number less than 100:"))
perfect=1
for perfect in range (1,number):
a=perfect*perfect
if a >= number:
break
print (a)
它将输出:
Input a positive number less than 100:81
1
4
9
16
25
36
49
64
但这些都是在一条单独的线上完成的
我怎样才能让它们都打印在同一行上?
Tags:
This is what you are looking for:
在
print
函数中使用end
参数:相关问题 更多 >
编程相关推荐