Nov-26-2019, 12:49 PM
Hi,
I was doing this exercise that calculate totalseconds from user input.
This is text:
I was doing this exercise that calculate totalseconds from user input.
This is text:
Quote:Write the algorithm that, having received a time input through three of its three components (hours,and this is my code:
minutes and seconds), it calculates the total value in seconds.
from datetime import datetime input_hour = str(input("Insert hour:minutes:seconds: ")) try: hour_start = datetime.strptime(input_hour, '%H:%M:%S') h, m ,s = hour_start.split(':') totalSeconds = int(h)*3600 + int(m) * 60 + int(s) print(totalSeconds) except ValueError: print("Wrong value!!!")Return this error:
Error:Attribute Error: 'datetime.datetime object has no attribute spilt'
Can you help me? I searched the internet but found nothing that is the same as my problem.