Skip to content

Commit 76d56ce

Browse files
committed
Merge branch 'master' of github.com:HowProgrammingWorks/DataTypes
2 parents cebd8f3 + e32fc5c commit 76d56ce

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Python/1-comments.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# single comment
2+
3+
4+
"""
5+
Multiline comments do not actualy exist in Python
6+
Sometimes you can meet creating of multiline comments by using tripple quotes,
7+
but that is not a comments in general.
8+
Tripple quotes in python treats as regular string and
9+
if it is not assigned to any variable it will be immediately garbage collected
10+
as soon as that code executes. So it doesn't affect execution.
11+
"""

Python/2-declaration.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#print(a)
2+
#NameError: name 'a' is not defined
3+
4+
a = 5
5+
print(a)
6+
type(a)
7+
#<class 'int'>
8+
9+
b = 5.2
10+
11+
dic = {'d': a, 'c': b}
12+
#obj
13+
print("Dictionary is: ", dic)
14+
15+
dic['c'] = 10
16+
print("Dictionary has been changed: ", dic)

Python/3-types.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
a = 5
2+
print(type(a))
3+
4+
b = 5.2
5+
print(type(b))
6+
#<class 'float'>
7+
8+
print(type(True))
9+
#<class 'bool'>
10+
11+
print(type(2+3j))
12+
#<class 'complex'>
13+
14+
print(type('hello'))
15+
#<class 'str'>
16+
17+
18+
person = {
19+
'name': 'Rikardo',
20+
'age': 27,
21+
'profession': 'actor'
22+
}
23+
24+
person['age'] = 28
25+
print(person)
26+
27+
array = {a, b, '56'}
28+
print('Arrray ', array)
29+
print(type(array))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy