-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples in Python for 1st, 2nd and 3rd files (#12)
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# single comment | ||
|
||
|
||
""" | ||
Multiline comments do not actualy exist in Python | ||
Sometimes you can meet creating of multiline comments by using tripple quotes, | ||
but that is not a comments in general. | ||
Tripple quotes in python treats as regular string and | ||
if it is not assigned to any variable it will be immediately garbage collected | ||
as soon as that code executes. So it doesn't affect execution. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#print(a) | ||
#NameError: name 'a' is not defined | ||
|
||
a = 5 | ||
print(a) | ||
type(a) | ||
#<class 'int'> | ||
|
||
b = 5.2 | ||
|
||
dic = {'d': a, 'c': b} | ||
#obj | ||
print("Dictionary is: ", dic) | ||
|
||
dic['c'] = 10 | ||
print("Dictionary has been changed: ", dic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
a = 5 | ||
print(type(a)) | ||
|
||
b = 5.2 | ||
print(type(b)) | ||
#<class 'float'> | ||
|
||
print(type(True)) | ||
#<class 'bool'> | ||
|
||
print(type(2+3j)) | ||
#<class 'complex'> | ||
|
||
print(type('hello')) | ||
#<class 'str'> | ||
|
||
|
||
person = { | ||
'name': 'Rikardo', | ||
'age': 27, | ||
'profession': 'actor' | ||
} | ||
|
||
person['age'] = 28 | ||
print(person) | ||
|
||
array = {a, b, '56'} | ||
print('Arrray ', array) | ||
print(type(array)) |