Last active
August 11, 2021 08:35
-
-
Save oiojin831/32f2f94a5017879f4cff7722fafa3265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dollar_to_won(dollar): | |
return dollar * 1150 | |
def won_to_dollar(won): | |
return won / 1150 | |
def convert(num, unit): | |
if unit == "dollar": | |
return dollar_to_won(num) | |
elif unit == "won": | |
return won_to_dollar(num) | |
class Movie(): | |
def __init__(self, a, b, c, d): | |
self.title = a | |
self.year = b | |
self.box_office = c | |
self.unit = d | |
def print_info(self): | |
print(self.title) | |
print(self.year) | |
print(self.box_office) | |
print(self.unit) | |
def print_revenue(self, unit): | |
if unit == self.unit: | |
print(f"{box_office} {unit}") | |
else: | |
print(f"{convert(self.box_office, unit)} {unit}") | |
movie1 = Movie("batman", 2012 ,32000, "dollar") | |
movie1.print_info() | |
movie2 = Movie("superman", 2012 ,2000, "dollar") | |
movie2.print_info() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment