Skip to content

Commit c7d20b7

Browse files
committed
Print speciality using Python!
Script print specality for Python!
1 parent 1022abc commit c7d20b7

File tree

3 files changed

+64
-81
lines changed

3 files changed

+64
-81
lines changed

Introduction/BaiscForLoop.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

Introduction/Mod Divmod.py

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
__author__ = 'Sanjay'
2+
# In Python 2, the default print is a simple IO method that doesn't give many options to play around with.
3+
#
4+
# The following two examples will summarize it.
5+
#
6+
# Example 1:
7+
#
8+
# var, var1, var2 = 1,2,3
9+
# print var
10+
# print var1, var2
11+
# Prints two lines and, in the second line, var1var1 and var2var2 are separated by a single space.
12+
#
13+
# Example 2:
14+
#
15+
# for i in xrange(10):
16+
# print i,
17+
# Prints each element separated by space on a single line. Removing the comma at the end will print each element on a new line.
18+
#
19+
# Let's import the advanced print_function from the __future__ module.
20+
#
21+
# Its method signature is below:
22+
#
23+
# print(value, ..., sep=' ', end='\n', file=sys.stdout)
24+
# Here, you can add values separated by a comma. The arguments sep, end, and file are optional, but they can prove helpful in formatting output without taking help from a string module.
25+
#
26+
# The argument definitions are below:
27+
# sep defines the delimiter between the values.
28+
# end defines what to print after the values.
29+
# file defines the output stream.
30+
#
31+
# Interesting, isn't it?
32+
#
33+
# Task
34+
# Read an integer NN.
35+
#
36+
# Without using any string methods, try to print the following:
37+
#
38+
# 1,2,3.....N1,2,3.....N
39+
#
40+
# Note that "....." represents the values in between.
41+
#
42+
# Input Format
43+
# The first line contains an integer NN.
44+
#
45+
# Output Format
46+
# Output the answer as explained in the task.
47+
#
48+
# Sample Input
49+
#
50+
# 3
51+
# Sample Output
52+
#
53+
# 123
54+
# Pro Tip
55+
# You can use the print function inside a map(). Can you do a 11 line code to solve the problem above?
56+
57+
# Enter your code here. Read input from STDIN. Print output to STDOUT
58+
from __future__ import print_function
59+
a = int(raw_input())
60+
s = []
61+
for i in range(1, (a+1)):
62+
s.append(i)
63+
print(int("".join(str(x) for x in s)))
64+

0 commit comments

Comments
 (0)