Skip to content

Commit 7465926

Browse files
intial commit
1 parent f85ae6e commit 7465926

File tree

13 files changed

+123
-15
lines changed

13 files changed

+123
-15
lines changed

Control Flow/Enumerate_2.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'''
2+
Zip Function to used to combine two list together and it's works like iteration.
3+
'''
4+
5+
6+
x = ['Hellow', 'Hi']
7+
y = ['World', 'Programmer']
8+
9+
10+
for x, y in zip (x, y):
11+
print(x,y)
12+
13+
14+
x = [5 ,7, 10, 12, 15, 20]
15+
y = [3 ,5, 4, 10, 10, 19]
16+
for x , y in zip(x,y):
17+
print('{} is greater than {}'.format(x,y))
18+

Control Flow/For In Loop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515

1616

1717
print('*'*20)
18+
1819
# create a Tuple
1920
tuple_01 = ('Java', 'Python', 'C-Language', 'C++', 'Ruby', 'Html', 'Perl')
2021
for i in list_01:
2122
print(i)
23+
2224
print('&'*20)
2325

2426
for index in range(len(list_01)):

Control Flow/Generator for Fibonacci Number.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#Simple Generator for fibonacci number
1+
'''Simple Generator for fibonacci number
2+
in Fibonacci series new number is generated by adding previous two number first two fibonacci numbers
3+
are 0 and 1.
4+
so fibonacci series
5+
0, 1 , 1 , 2 , 3, 5, 8, 13, 21, 34.......
6+
'''
27
def sub(limit):
38
#initializing first two fibonacci number
49
a, b = 0, 1
@@ -7,9 +12,6 @@ def sub(limit):
712
while a < limit:
813
yield a
914
a, b = b, a+b
10-
11-
x = sub(5)
12-
1315
#Using For in Loop
1416
print("\n For In Loop \n")
1517
for i in sub(5):

Control Flow/Loop 3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
@author: Looping Example 2
66
"""
77

8-
Phone = ['iphone 10', 'Samsung s10', 'One plus 7 pro', 'Redmi note 7 pro']
8+
Phone = ['Iphone 10', 'Samsung S10', 'One plus 7 pro', 'Redmi note 7 pro']
99
accessories = ['Charger 3.0', 'Headphones']
1010

1111
prices ={1:'80000', 2:'70000', 3:'60000', 4:'15000', 5:'1000', 6:'2000'}
1212

1313
for index, c in enumerate(Phone, start =1):
14-
print("Phone : %s Price : %s" %(c, prices[index]))
14+
print((c, prices[index]))
1515

1616
for index, a in enumerate(accessories, start =1):
17-
print("Accessories : %s Price %s" %(a, prices[index+len(Phone)]))
17+
print((a, prices[index+len(Phone)]))

Control Flow/Loop Using enumerate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
list_01 = [1, 3, 6, 4, 7, 1, 2, 3, 1, 7, 6]
2828
print("The list in sorted order is : ")
2929
for i in sorted(list_01):
30-
print(i, end ='')
30+
print(i, end ='')
3131

3232
print('\n') # only for space in output
3333
print("List Is in Order Without Duplicates Value ")

Control Flow/Nested Loop.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
statements(s)
66
statements(s)
77
'''
8-
9-
from __future__ import print_function
10-
11-
for i in range(1,4):
8+
for i in range(1,7):
129
for j in range(i):
1310
print(i, end ='')
14-
print()
11+
print()

Control Flow/Printing Pyramid Pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ def pypart(n):
99
print("*",end = '')
1010
print('\n')
1111

12-
n = 10
12+
n = 5
1313
pypart(n)

Control Flow/Switch Case.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ def change_data_type(argument):
1212
1 : "one",
1313
2 : "two",
1414
3 : "three",
15+
4 : "Fout",
16+
5 : "Five",
17+
6 : "Six",
18+
7 : "Seven"
19+
8 : "Eight"
20+
9 : "Nine"
1521
}
16-
return switcher.get(argument, "Choose Between 0 to 3")
22+
return switcher.get(argument, "Choose Between 0 to 9")
1723

1824
if __name__ == "__main__":
1925
x = int(input(''))

MatplotLib/Sine cosine Graph.png

32.6 KB
Loading

MatplotLib/matplotlib_2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fri Nov 1 14:10:48 2019
4+
5+
@author:
6+
"""
7+

0 commit comments

Comments
 (0)