Skip to content
Open
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
43 changes: 27 additions & 16 deletions OOP/myclass.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#!/usr/bin/env python

class myClass():
#constructor
def __init__(self, username, eyecolor, height, weight, age, birthdate):
self.username = username
self.eyecolor = eyecolor
self.height = height
self.weight = weight
self.age = age
self.birthdate = birthdate

#name printing method
def myMethod(self):
print("Hi,", self.username)

#bmi calculator and printer
def bmi(self):
conversion = (self.height/10) + (4/12)
bmimath = (conversion*4.88/self.height*self.height)
print("{}, your BMI is: {}".format(self.username, bmimath))


class myClass:
name = "Dan"
eyes = "blue"
height = 54
weight = 165
age = 34
birth = 040277

def myMethod
print "Hi %s", % (name)

me = myClass

print me.eyes
print me.age
print me.weight
print me.birth
dan = myClass("Dan", "Blue", 54, 165, 34, "04/02/77")
dan.myMethod()
print("Eyecolor:", dan.eyecolor)
print("Age:", dan.age)
print("Weight:", dan.weight)
print("Birth Date:", dan.birthdate)
print("Height:", dan.height)