-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.py
More file actions
184 lines (127 loc) · 3.44 KB
/
test.py
File metadata and controls
184 lines (127 loc) · 3.44 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# def n_times(times):
# return lambda n : n * times
# doubler = n_times(2)
# tripler = n_times(3)
# print(doubler(10))
# print(tripler(10))
# n_times = lambda n, func: func(n)
# print(n_times(10, lambda n : 2 * n))
# print(n_times(10, lambda n : 3 * n))
# def fibonacci(n, amount):
# a = b = 1
# result = []
# for i in range(n):
# result.append(a)
# if len(result) == amount:
# yield result
# result = []
# a, b = b, a + b
# gen = fibonacci(50000, 50)
# print(next(gen))
# print(next(gen))
# def wrapper_function(func):
# def inner_function():
# print('Printing before function!')
# func()
# print('Printing after function!')
# return inner_function()
# def a_function():
# print('I`m the function!')
# wrapping = wrapper_function(a_function)
# def wrapper_function(func):
# def inner_function():
# print('Printing before function!')
# func()
# print('Printing after function!')
# return inner_function
# @wrapper_function
# def a_function():
# print('I`m the function')
# a_function()
# class Father:
# '''
# This is a person class and have name in it.
# '''
# def __repr__(self):
# return 'This is a the Father class'
# class Mother:
# '''
# This is a person class and have name in it.
# '''
# def __init__(self):
# print(f'Mothers last name')
# class Son(Father, Mother):
# "This is a child class from Mother and Father"
# isSon = True
# def __init__(self):
# super().__init__()
# print(f'I am a Son and I have both last names')
# somebody = Father()
# print(Son)
# class Person:
# '''
# This is a person class and have name in it.
# '''
# def __init__(self, name):
# self.name = name
# # def __repr__(self):
# # return f'I am of class Person and my name is {self.name}'
# me = Person('Ezequiel')
# another_guy = Person('Nicolas')
# print(me)
# print(another_guy)
# number = int | float
# def a_function() -> number:
# return 1
# a_number = 1
# while a_number < 10:
# print(a_number)
# a_number += 1
# else:
# print('No longer less than 10...')
# class Person:
# def __init__(self):
# print(f"Im Person")
# class Father(Person):
# """
# This is a person class and have name in it.
# """
# def __init__(self):
# print(f"Fathers last name")
# class Mother:
# """
# This is a person class and have name in it.
# """
# def __init__(self):
# print(f"Mothers last name")
# class Son(Father, Mother):
# "This is a child class from Mother and Father"
# __isSon = True
# def __init__(self):
# super().__init__()
# print(f"I am a Son and I have both last names")
# print(dir(Son))
# class Person:
# def __init__(self, nombre):
# self.nombre = nombre
# self.__password = "estoEsUnaPass"
# @property
# def password(self):
# return self.__password
# @password.setter
# def password(self, password):
# self.__password = password
# yo = Person("Eze")
# print(yo.password)
# yo.password = "otra"
# print(yo.password)
class Person:
def __init__(self, name):
self.name = name
def say_hi(self):
print(f"Hello, my name is {self.name}")
a_person = Person("Nicolas")
a_person.say_hi()
print(a_person.name)
a_person.lastname = "Perez"
print(a_person.lastname)