-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
96 lines (72 loc) · 1.85 KB
/
main.py
File metadata and controls
96 lines (72 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# python_instructors = ["skinny","Mutemi","John","Ali","Maureen","Grey"]
# count = 0
# while count < len(python_instructors):
# print("instructor=",python_instructors[count])
# count += 1
#A = [[1, 4, 5, 12],[-5, 8, 9, 0],[-6, 7, 11, 19]]
# print("A=",A)
#print("A[1]=",A[1])
# print("A[1][2]=",A[1][2])
# print("A=",A[0][3])
# column = []; # empty list
# for row in A:
# column.append(row[2])
# print("3rd column=",column)
#transposing using nested loop comprehesion
# X = [[12,7],
# [4 ,5],
# [7 ,8]]
# Result = [[X[i][j] for i in range(len(X))] for j in range(len(X[0]))]
# for r in Result:
# print(r)
#transposing
# X = [[12,7],
# [4 ,5],
# [3 ,8]]
# result = [[0,0,0],
# [0,0,0]]
# # iterate through rows
# for i in range(len(X)):
# # iterate through columns
# for j in range(len(X[0])):
# result[j][i] = X[i][j]
# for r in result:
# print(r)
# iterate through rows
#for i in range(len(X)):
# # iterate through columns
#for j in range(len(X)):
# result[i][j] = X[i][j] + Y[i][j]
# for r in result:
# print(r)
#numpy practice
# import numpy as np
# a = np.array([1, 2, 3])
# print(a)
# vowels = ["a", "e", "i", "o", "u"]
# def vowel_counter(str):
# return len([char for char in str if char in vowels])
# print(vowel_counter("enthusiasm"))
#classes and objects
# class Person:
# def __init__(self):
# self.name = "kamash"
# self.age = 25
# details = Person()
# details.name = "Giddy"
# details.age = 21
# print(details.name)
# print(details.age)
# class Person:
# def displayinfo(self):
# print('personal information')
# p1 = Person()
# p1.displayinfo()
# class Person:
# def __init__(self,age,name):
# self.name = name
# self.age = age
# def displayinfo(self):
# print("person name:",self.name,",person age:",self.age)
# p1=Person("kamash",25)
# p1.displayinfo()