如何编码需要用行打印的东西
a
是def star(a)
中的参数,
我必须定义def
和编码。
我在问a = int(输入(“什么是?:”)
。
例如 第一行有一个标志, 第二行有两个标志, 第三行有3个标志,完成了。
def star(a):
#idk
return #dk
a=int(input("a is a: "))
print("Shape: ", star(a))
a
is a parameter in def star(a)
I have to define a def
and coding.
Im asking a= int(input("what is a?: ")
.
For example if a
is 3
:
first line has one sign,
second line has two sign,
third line has 3 sign and done.
def star(a):
#idk
return #dk
a=int(input("a is a: "))
print("Shape: ", star(a))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以在 python 中使用
*
来乘以字符串!如果您希望星星从中间开始,您应该在
print_line
中添加一些逻辑以形成一个字符串,然后打印该字符串。编辑:在
print_line
中添加 +1 以处理第一次迭代为 0 的情况。You can just multiply strings in python using
*
!If you want the stars to start in the middle, you should add some logic in
print_line
to form a string, than print that string.edit: added +1 in
print_line
to deal with the first iteration being 0.你的问题不是最清楚,但我还是会尽力回答。
输出:
这就是你想要的吗?
Your question isn't the clearest, but I'll try to answer nonetheless.
Output:
Is that what you were going for?