您的位置:首页 > 编程语言

HackerRank,一行代码解决输出问题

2015-12-03 00:00 525 查看
Task
Read an integer N.
Without using any string methods, try to print the following:
1,2,3.....N
Note that "....." represents the values in between.
Input Format
The first line contains an integer N.
Output Format
Output the answer as explained in the task.
Sample Input
3


Sample Output
123


Pro Tip
You can use the print function inside a map(). Can you do a 1 line code to solve the problem above?
from __future__ import print_function
map(lambda x: print(x,end=''), range(1,input()+1))
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: