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

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?

这道题技巧性很强,需要用到map、xrange、 lambda和python3里print函数特性。

from __future__ import print_function

map(lambda x : print(x, end=''), xrange(1, input() + 1))


你可能感兴趣的:(python输出问题,一行代码解决)