GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Examples in Python for 1st, 2nd and 3rd files (#12) · HowProgrammingWorks/DataTypes@e32fc5c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Python
    • 1-comments.py
    • 2-declaration.py
    • 3-types.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Python/1-comments.py‎

Copy file name to clipboard
+11Lines 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+
"""
Collapse file

‎Python/2-declaration.py‎

Copy file name to clipboard
+16Lines 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)
Collapse file

‎Python/3-types.py‎

Copy file name to clipboard
+29Lines 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 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.