Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tym's Checkpoint #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pylint = "*"

[packages]
atomicwrites = "*"
Expand Down
141 changes: 115 additions & 26 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@
# - "windows_count" -> data_type: int, value: 8
# - "glare" -> data_type: boolean, value: True

dictionary_classroom = {
'chairs': 35,
'name': 'CR3',
'windows_count': 8,
'glare': True
}


# #2: Create a list called "num_list" withs values 1 through 4 in it:

num_list = [1,2,3,4]


# #3: Create a list called "teacher_list" with the strings "zakk", "jimmy",
# "hammad", and "erin" in it:


teacher_list = ['zakk', 'jimmy', 'hammad', 'erin']

# Commit when you finish working on these questions!
38 changes: 38 additions & 0 deletions oop.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,61 @@



class Vehicle:
def __init__(self, vehicle_type, wheel_count, name, mpg):
self.vehicle_type = vehicle_type
self.wheel_count = wheel_count
self.name = name
self.mpg = {
'city': '',
'highway': '',
'combined': '',
'get_vehicle_type': self.vehicle_type,
'get_vehicle_drive': print(f'I have {self.wheel_count} wheel drive')
}



# #2: Create a Motorcycle class that inherits from the Vehicle class and has the
# following properties and methods:
# - all the properties inherited from the Vehicle class
# - method: `pop_wheelie` if `wheel_count` is not equal to 2 then it should return False
# otherwise return "popped a wheelie!"

class Motorcycle (Vehicle):
def __init__(self, vehicle_type, wheel_count, name, mpg):
super().__init__(vehicle_type, wheel_count,name,mpg)
self.pop_wheelie:
if self.wheel_count !== 2:
return False
else:
print('popped a wheelie')



# #3: Define a Car class that inherits from the Vehicle class with the following properties and methods:
# - all the properties inherited from the Vehicle class
# - property: `wheel_count` defaults to 4
# - method: `can_drive` that should return 'Vrrooooom Vroooom'

class Car (Vehicle):
def __init__(self, vehicle_type, wheel_count, name, mpg):
super().__init__(vehicle_type, wheel_count,name,mpg)
self.wheel_count = 4
self.can_drive = 'Vrrooooom Vroooom'



# #4: Define a Truck class that inherits from the Vehicle class with the following properties and methods:
# - all the properties inherited from the Vehicle class
# - method: `rev_engine` that should return a string 'rreevv!'

class Truck (Vehicle):
def __init__(self, vehicle_type, wheel_count, name, mpg):
super().__init__(vehicle_type, wheel_count,name,mpg)
self.rev_engine = 'rreevv!'




# Commit when you finish working on these questions!