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
但它会在一个单独的行上完成这些
答案 0 :(得分:0)
使用end
函数中的print
参数:
print(..., end=" ")
答案 1 :(得分:0)
print(a, end=" ") # Appends a space instead of a newline