+ 1

Please how can i create a data type in python?

I want to able to input data that takes time in "hour,the minutes, and either am or pm?

25th Jun 2018, 10:31 AM
Njimukara
1 Answer
0
simple method input each item in separate variables and concatenate them using string or using class like this class Time:   def __init__(self, hour, minute,meridian):     self.hour = hour     self.minute = minute self.meridian = meridian def displayTime(self): print (self.hour+self.minute+self.meridian) #creating object t1 = Time(10,30,PM); t1.displayTime()
25th Jun 2018, 11:27 AM
sairam kamalay
sairam kamalay - avatar