-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcwork.py
More file actions
142 lines (91 loc) · 2.38 KB
/
cwork.py
File metadata and controls
142 lines (91 loc) · 2.38 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
hello = '''"just like knowledge, you cant take self-discipline for granted. " \
"unfortunately, being a self-disciplined person isn't a "one and done" kind of thing.
Once you have learned how to live that way, you can still lose it if you don't consistently strengthen it
by setting new challenges and rejecting instant gratification in favor of bigger future rewards" '''
print(len(hello))
print(hello[4:20])
def call_me(firstname):
print(firstname + ":", "Micheal")
call_me("Ben")
call_me("Mike")
call_me("john")
call_me("Macbeth")
call_me("stanley")
# first 10 multiple of 6
number = int(input("enter number: "))
print("the multiples are: ")
for i in range(1, 10):
print(number * i, end=" ")
def row(s, n):
return s * n
print(row("hello world! ", 5))
def mult(x, y):
return x * y
num1 = 90
num2 = 89
print(mult(num1, num2))
list1 = [5, 7, 9, 4]
list2 = [3, 9, 8, 7]
multiply = []
for number1, number2 in zip(list1, list2):
multiply.append(number1 * number2)
print(multiply)
import math
list1 = [20, 10, 15, 16]
list2 = [14, 12, 16, 11]
p1 = math.prod(list1)
p2 = math.prod(list2)
print("the product of list1 is: ", p1)
print("the product of list2 is: ", p2)
def multiplylist(my_list):
r = 1
for a in my_list:
r = r * a
return r
list1 = [3, 5, 6]
list2 = [7, 9, 8]
print(multiplylist(list1))
print(multiplylist(list2))
# first 10 multiple of 8
number = int(input("enter the number"))
print("the multiple are: ")
for i in range(1, 10):
print(number * i, end=" ")
# first 20 multiple of 4
number = int(input("enter the number: "))
for i in range(1, 20):
print(number * i, end=" ")
# first 5 multiple of 2
number = int(input("enter the number: "))
for i in range(1, 5):
print(number * i, end=" ")
def mult(x, y):
return x * y
num1 = 5
num2 = 6
print(mult(num1, num2))
number = 171 * 5
print("the product is ", number)
number = 5 * 8
print(number)
num1 = complex(3, 4)
num2 = complex(2, 5)
result = num1 * num2
print(result)
# multiplying complex numbers
num1 = complex(3, 4)
num2 = complex(5, 6)
result = num1 * num2
print(result)
def row(s, n):
return s * n
print(row("hello world!", 5))
num1 = complex(4, 6)
num2 = complex(8, 3)
num3 = complex(2, 9)
result = num1 * num2 + num3
print(result)
number = int(input("enter the number"))
print("the product is ", number)
number = 8 * 9
print(number)