Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusBernalBermudez committed Mar 1, 2024
1 parent 3924886 commit b9a858a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 8 additions & 7 deletions language/2_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
print('4- ', large_str[:]) # it is copy
age = 36
anniversary = date(1991, 10, 12)
txt = f"My name is \"John\", and I am {age}, my anniversary is {anniversary:%A, %B %d, %Y}" # \ is esc
print('5- ', 'text {}'.format(age))
print('6- ', f'text {age}')
txt = f"My name is \"John\", and I am {age}, my anniversary is {anniversary:%A, %B %d, %Y}" # \ is esc %A: day of week, %B: montnt...
print('5-',txt)
print('6- ', 'text {}'.format(age))
print('7- ', f'text {age}')

my_list = ["apple", "banana", "cherry"] # list .append .extend .remove .pop .popleft .clear .reverse ...
my_tuple = "apple", "banana", "cherry" # tuple immutable
Expand All @@ -35,7 +36,7 @@

bytes_var = b'byte'

print('7- type of str_var: ', type(str_var))
print('8- type of age: ', type(age))
print('9- type of anniversary: ', type(anniversary))
print('10- type of bytes_var: ', type(bytes_var))
print('8- type of str_var: ', type(str_var))
print('9- type of age: ', type(age))
print('10- type of anniversary: ', type(anniversary))
print('11- type of bytes_var: ', type(bytes_var))
1 change: 1 addition & 0 deletions language/5_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
my_dict.setdefault('name', 'only-if-not-exist')
my_dict.setdefault('new', 'new-value')
print('4- ', my_dict.keys(), '::', my_dict.values())
print('5- ', my_dict)
3 changes: 2 additions & 1 deletion language/7_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __private(self): # private

print('1 ---------------- ')
my_class = MyClass('me')
my_class.name = "..."
my_class.dynamic()
my_class.new_attribute = "New!!!"
my_class.new_function = dynamic_function
Expand Down Expand Up @@ -94,5 +95,5 @@ def __call__(self, value): # class default function


my_callable = Callable()
my_callable("!!!") # class is callable
my_callable("!!!") # class is callable my_callable.__call__("!!!")
# my_class() ERROR!!!

0 comments on commit b9a858a

Please sign in to comment.