Skip to content

Commit 1ee540e

Browse files
committed
section6 final
1 parent 68ba534 commit 1ee540e

File tree

26 files changed

+355
-0
lines changed

26 files changed

+355
-0
lines changed

Section6/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/.idea/Section6.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section6/lecture61/Program1.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Program to show classes and objects in Python
2+
3+
class Person:
4+
5+
country = "India" # class attributes
6+
7+
def __init__(self,name, age):
8+
self.name = name # instance attribute
9+
self.age = age
10+
11+
12+
person1 = Person("David", 31)
13+
print("person 1 name = ", person1.name)
14+
print("person 1 age = ", person1.age)
15+
person2 = Person("Paul",32)
16+
print("person 2 name = ", person2.name)
17+
print("person 2 age = ", person2.age)
18+
print(" class attribute = ", Person.country)

Section6/lecture61/Program2.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Program to show classes and objects in Python
2+
3+
class Person:
4+
name = "" # class attribute
5+
age = 0
6+
7+
def run(self):
8+
print("Person running")
9+
10+
def talk(self):
11+
print("Person talking")
12+
13+
14+
person1 = Person()
15+
person1.name = "David"
16+
person1.age = 31
17+
person1.run()
18+
person1.talk()
19+
print("-------------------------------")
20+
person2 = Person()
21+
person2.name = "Paul"
22+
person2.age = 30
23+
person2.run()
24+
person2.talk()

Section6/lecture61/__init__.py

Whitespace-only changes.

Section6/lecture62/Program1.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Program to show __init__ method
2+
3+
class Car:
4+
5+
def __init__(self):
6+
self.name = "Audi"
7+
self.colour = "Red"
8+
9+
10+
obj1 = Car()
11+
print(obj1.name)
12+
print(obj1.colour)
13+

0 commit comments

Comments
 (0)