You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.3 KiB
Python

# Activity Solution:
# 1. In the s03 folder, create an "activity" folder, and inside it, create an "activity.py" file.
# 2. Create a class called "Camper" and give it the attributes: name, batch, and course_type.
class Camper():
def __init__(self, name, batch, course_type):
self.name = name
self.batch = batch
self.course_type = course_type
# 3.Create a method called career_track that prints the string: `Currently enrolled in the <value of course_type> program.`
def career_track(self):
print(f'Currently enrolled in the {self.course_type} program.')
# 4. Create a method called info that prints the string: `My name is <value of name> of batch <value of batch>.`
def info(self):
print(f'My name is {self.name} of batch.')
# 5. Create an object from the Camper class called zuitt_camper, and pass in values for name, batch, and course_type.
zuitt_camper = Camper('Alan', 100, 'Python Short Course')
# 6. Print the values of name, batch, and course_type individually from the zuitt_camper object.
print(f'Camper Name: {zuitt_camper.name}')
# 7. Execute the info and career_track method of the object.
zuitt_camper.career_track()
zuitt_camper.info()
# 8. Update your local session Git repository and push to Git with the commit message "Add activity code s03".
# 9. Add the repository link in Boodle for s03.