编写函数show(n,name),输出n行的字符串“happy birthday ***”,“***”由name指定 python
时间: 2023-10-21 07:16:45 浏览: 105
生日快乐完整代码使用Python语言编写
代码如下:
```
def show(n, name):
for i in range(n):
print("Happy birthday", name, "!")
```
使用方法:
```
show(5, "Jerry")
```
输出结果:
```
Happy birthday Jerry !
Happy birthday Jerry !
Happy birthday Jerry !
Happy birthday Jerry !
Happy birthday Jerry !
```
阅读全文