-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable_scope_example.py
More file actions
77 lines (41 loc) · 890 Bytes
/
variable_scope_example.py
File metadata and controls
77 lines (41 loc) · 890 Bytes
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
# -*- coding: utf-8 -*-
"""
This program is codes in the PDF variable scope module 5
@author: Tiago Saraiva
@date: 2024-02-05
"""
a = "\n********************************************************************\n"
print(a)
x = 10
def increase_x(x):
x += 5
return x
print(x)
print(increase_x(x))
print(x)
print(a)
y = 10
def increase_y(y):
y += 5
return y
print(y)
print(increase_y(y))
print(y)
print(a)
class Employee():
"""This class contains employee data."""
def __init__(self, id, name, income):
self.name = name
self.id = id
self.income = income
def income_taxes(self):
"""This function calculates taxes based on income."""
rate = 0.20
return rate * self.income
employee1 = Employee(1, 'Max', 20000)
print(employee1.income_taxes())
print(a)
class Color():
YELLOW = 1
RED = 2
BLUE = 3