From 36e72ea2be144c10eb89bc988de64919fd5348d7 Mon Sep 17 00:00:00 2001 From: ChrisBlesson2598 Date: Fri, 11 Oct 2019 11:11:42 +0530 Subject: [PATCH] added almost all the basics of python for absolute beginners --- armstrong no. => armstrong no | 0 py tutorial.html | 13616 ++++++++++++++++++++++++++++++++ 2 files changed, 13616 insertions(+) rename armstrong no. => armstrong no (100%) create mode 100644 py tutorial.html diff --git a/armstrong no. b/armstrong no similarity index 100% rename from armstrong no. rename to armstrong no diff --git a/py tutorial.html b/py tutorial.html new file mode 100644 index 0000000..d69d49e --- /dev/null +++ b/py tutorial.html @@ -0,0 +1,13616 @@ + + + + +py tutorial + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
In [9]:
+
+
+
s=input()
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Make way for Raj #universal Coder
+
+
+
+ +
+
+ +
+
+
+
In [10]:
+
+
+
s=list(map(str,s.split(" ")))
+print(s)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
['Make', 'way', 'for', 'Raj', '#universal', 'Coder']
+
+
+
+ +
+
+ +
+
+
+
In [11]:
+
+
+
print(s[3])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Raj
+
+
+
+ +
+
+ +
+
+
+
+

inorder to reverse use slice (::)

+
+
+
+
+
+
In [12]:
+
+
+
text="Marana coder"
+print(text[::-1])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
redoc anaraM
+
+
+
+ +
+
+ +
+
+
+
+

traverse using slice

+
+
+
+
+
+
In [13]:
+
+
+
print(text[0:2])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Ma
+
+
+
+ +
+
+ +
+
+
+
In [14]:
+
+
+
print(text[0:])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Marana coder
+
+
+
+ +
+
+ +
+
+
+
In [15]:
+
+
+
print(text[0:len(text)-2])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
Marana cod
+
+
+
+ +
+
+ +
+
+
+
In [17]:
+
+
+
text=list(text)
+text.sort()
+print(text)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
[' ', 'M', 'a', 'a', 'a', 'c', 'd', 'e', 'n', 'o', 'r', 'r']
+
+
+
+ +
+
+ +
+
+
+
In [20]:
+
+
+
num=[];num=1,2,3
+print(sum(num))
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
6
+
+
+
+ +
+
+ +
+
+
+
+

Remove duplicates

+
+
+
+
+
+
In [21]:
+
+
+
num=[];num=[1,2,3,4,5,6,1,1,3,4,55,6,8]
+num=list(set(num))
+print(num)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
[1, 2, 3, 4, 5, 6, 8, 55]
+
+
+
+ +
+
+ +
+
+
+
In [26]:
+
+
+
for i in range(len(num)):
+    print(num[i],end=" ")
+    #end is used to give space
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
1 2 3 4 5 6 8 55 
+
+
+ +
+
+ +
+
+
+
In [27]:
+
+
+
for i in range(len(num)):
+    print(num[i])
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
1
+2
+3
+4
+5
+6
+8
+55
+
+
+
+ +
+
+ +
+
+
+
+

inorder to reverse iterate using for loop

+
+
+
+
+
+
In [33]:
+
+
+
num=[];num=[1,2,3,4,5,6,7,8,9,10]
+print(num)
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+
+
+
+ +
+
+ +
+
+
+
In [39]:
+
+
+
for i in range(len(num)-1,-1,-1):
+    print(num[i],end=" ")
+ # first parameter indicates starting point second parameter indicates endpoint+1,last parameter is used to get values as such in the list   
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
10 9 8 7 6 5 4 3 2 1 
+
+
+ +
+
+ +
+
+
+
In [ ]:
+
+
+
 
+
+ +
+
+
+ +
+
+
+ + + + + +