📅  最后修改于: 2023-12-03 15:36:12.708000             🧑  作者: Mango
今天是我的生日!🎂🎉🎁
作为程序员,我想要写一些代码来庆祝这个特殊的日子。
以下是一些用 Python 代码实现的生日祝福:
age = 25
print("Happy " + str(age) + "th birthday to me!")
gifts = ['laptop', 'smartphone', 'headphones']
for gift in gifts:
print("I hope I get a " + gift + " as a birthday gift!")
def sing_happy_birthday(name):
print("Happy birthday to you")
print("Happy birthday to you")
print("Happy birthday dear " + name)
print("Happy birthday to you!")
sing_happy_birthday("me")
输出结果:
Happy 25th birthday to me!
I hope I get a laptop as a birthday gift!
I hope I get a smartphone as a birthday gift!
I hope I get a headphones as a birthday gift!
Happy birthday to you
Happy birthday to you
Happy birthday dear me
Happy birthday to you!
感谢阅读这篇简短的代码示例。再次祝自己生日快乐!🎂🥳🎁