0
0

PythonのPrint() とend

Posted at

printのendの初期値は\nですが、endに値を与えると与えた値で終わりになり、改行しなくなる
逆にprint()なら改行のみになる
temp = input('请输入一个整数:')
number = int(temp)
while number:
i = number - 1
while i:
print(' ', end='')
i = i - 1
j = number
while j:
print('*', end = '')
j = j - 1
print()
number = number - 1

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0