列表

详情


NP50. 程序员节

描述

牛牛、牛妹和牛可乐都是Nowcoder的忠实用户,又到了一年一度的程序员节(10月24号),毫无疑问,他们都登录Nowcoder了,因为他们还没有刷完牛客题霸...
Nowcoder的管理员想对他们发送一些简单登录问候消息,并对他们表达了节日祝福。
创建一个依次包含字符串 'Niuniu' 、'Niumei' 和 'Niu Ke Le' 的列表users_list
请使用for循环遍历列表user_list,依次对列表users_list中的名字输出一行类似 'Hi, Niuniu! Welcome to Nowcoder!' 的字符串,
for循环结束后,最后输出一行字符串 "Happy Programmers' Day to everyone!"

输入描述

输出描述

按题目描述进行输出即可。
Hi, Niuniu! Welcome to Nowcoder!
Hi, Niumei! Welcome to Nowcoder!
Hi, Niu Ke Le! Welcome to Nowcoder!
Happy Programmers' Day to everyone!

原站题解

Python 解法, 执行用时: 9ms, 内存消耗: 2856KB, 提交时间: 2022-06-03

users_list=['Niuniu' ,'Niumei' , 'Niu Ke Le' ]
for i in  users_list:
    print( 'Hi, %s! Welcome to Nowcoder!' %i)
print("Happy Programmers' Day to everyone!")

Python 解法, 执行用时: 10ms, 内存消耗: 2828KB, 提交时间: 2022-06-30

user_list = ['Niuniu', 'Niumei', 'Niu Ke Le']
for i in user_list:
    print 'Hi, ' + i + '! Welcome to Nowcoder!'
print 'Happy Programmers\' Day to everyone!'

Python 解法, 执行用时: 10ms, 内存消耗: 2832KB, 提交时间: 2022-07-15

users_list = ['Niuniu', 'Niumei', 'Niu Ke Le']

for user in users_list:
    print ('Hi, %s! Welcome to Nowcoder!' % user)
else:
    print "Happy Programmers' Day to everyone!"

Python 解法, 执行用时: 10ms, 内存消耗: 2832KB, 提交时间: 2022-06-26

# users_list = ['Niuniu', 'Niumei', 'Niu Ke Le']
# for user in users_list:
#     print(f'Hi, {user}! Welcome to Nowcoder!')
# print("Happy Programmers' Day to everyone!")

users_list = ['Niuniu','Niumei','Niu Ke Le']
for i in users_list:
    print('Hi, {}! Welcome to Nowcoder!'.format(i))
print('Happy Programmers\' Day to everyone!')

Python 解法, 执行用时: 10ms, 内存消耗: 2836KB, 提交时间: 2022-07-05

users_list = [ 'Niuniu' ,'Niumei', 'Niu Ke Le']
for  i in users_list:
    print('Hi, {}! Welcome to Nowcoder!'.format(i))
print("Happy Programmers' Day to everyone!")

上一题