输出50个*
输出*号的方法我知道的只有while循环和for循环,要输出50个*号
例如:
while x<=50:
print('*',end='')
x+=1
还有啥方法? 是什么输出格式呢? 直接这样:
print("*" * 50) True_123 发表于 2022-3-3 18:31
是什么输出格式呢?
格式随便吧,反正输出50个*就行了 python爱好者. 发表于 2022-3-3 18:34
直接这样:
还有吗?越多越好{:10_254:} 三楼的是最简单的了吧 wsndc 发表于 2022-3-3 18:40
还有吗?越多越好
没了,循环大法是最好用的{:10_304:} #!/usr/bin/env python
#coding=utf-8
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
print('*', end = '')
生成程序的程序
#!/usr/bin/env python
#coding=utf-8
print('#!/usr/bin/env python')
print('#coding=utf-8')
print('')
count = 50
while count:
print("print('*', end = '')")
count -= 1
#!/usr/bin/env python
#coding=utf-8
print('**************************************************')
这是基本知识吧?
print ('*' * 50) def u(a):
b = "*" * a
return(b)
a = int(input("请输入重复次数:"))
print(u(a)) 还可以继续玩
def u(a,b):
c = a * b
return(c)
a = input("请输入重复符号:")
b = int(input("请输入重复次数:"))
print(u(a,b)) 简单点
a,b=(input("请输入重复符号:"),int(input("请输入重复次数:")))
print(a * b) print("*\n" * 50) for a in range(1,50):
print('*')
还有:
a=[]
for num in range(1,50):
a.append('*')
还有:
..........
print(a)
页:
[1]