Skip to content

Update myclass.py #2

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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)