Days_11 525,600 minutes
Ari Wira Saputra
Posted on March 23, 2023
Use the power of breaking a program down into its parts. We could Google this, but why not make a program for this instead.
60 seconds = 1 minute
60 minutes = 1 hour
24 hours = 1 day
31 days = 1 month
12 months = 1 year
365 days = 1 year
366 day = 1 leap year (this is every four years)
class times():
def __init__(self, seconds=0, minutes=0, hours=0, days=0, months=0, year=0):
self.seconds = seconds
self.minutes = minutes
self.hours = hours
self.days = days
self.months = months
self.year = year
def konversi_second(self):
if self.seconds == "M" or self.seconds == "m" :
self.seconds = int(input("Masukan Nilainya secondnya: "))
t = self.seconds / 60
print(t, "menit")
elif self.seconds == "H" or self.seconds == "h":
self.seconds = int(input("Masukan Nilainya secondnya: "))
t = self.seconds / 3600
print(t, "Hours")
else:
print("Masukan Nilai Yang bener")
def Konversi_Menit(self):
if self.minutes == "S" or self.minutes== "s" :
self.minutes = int(input("Masukan Nilainya menitnya: "))
t = self.minutes * 60
print(t, "Second")
elif self.minutes == "H" or self.minutes == "h" :
self.minutes = int(input("Masukan Nilainya menitnya: "))
t = self.minutes / 60
print(t, "Hours")
else:
print("Masukan Nilai Yang bener!!")
def call():
t = times()
t.seconds = input("Masukkan nilai konversi second(menit atau jam) M/H: ")
t.konversi_second()
t.minutes = input("Masukkan nilai konversi Menit(second ke jam) S/H:")
t.Konversi_Menit()
call()
💖 💪 🙅 🚩
Ari Wira Saputra
Posted on March 23, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024