forked from CameronKennedy21/Workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogramming_language.py
More file actions
37 lines (24 loc) · 939 Bytes
/
Copy pathprogramming_language.py
File metadata and controls
37 lines (24 loc) · 939 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
__author__ = 'sci-lmw1'
# Programming Language class for CP1404
class ProgrammingLanguage:
def __init__(self, name, typing, reflection, year):
self.name = name
self.typing = typing
self.reflection = reflection
self.year = year
def __str__(self):
return "{}, {} Typing, Reflection={}, First appeared in {}".format(self.name, self.typing, self.reflection, self.year)
def is_dynamic(self):
return self.typing == "Dynamic"
def test():
ruby = ProgrammingLanguage("Ruby", "Dynamic", True, 1995)
python = ProgrammingLanguage("Python", "Dynamic", True, 1991)
vb = ProgrammingLanguage("Visual Basic", "Static", False, 1991)
languages = [ruby, python, vb]
print(python)
print("The dynamically typed languages are:")
for language in languages:
if language.is_dynamic():
print(language.name)
if __name__ == "__main__":
test()