D
D
Dream2021-06-11 12:48:48
Python
Dream, 2021-06-11 12:48:48

How to make a time report if the user writes for example 1m?

How to make a time report by type: 1m (1 minute), 1d (1 day), etc.? To be able to use only: s (sec), m (min), h (hour), d (day), m (month), y (year). I am writing a bot, I need it to report the time that the user wrote.

For example:
The user wrote 1m - so the team reports 1 minute

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mrkliner, 2021-06-11
@dreameddd

import time as t
print("Enter the time you want to put without numbers (s, m, h)\nTime: ")
time = input()
if time == 's':
print("Enter the number of seconds you want to wait\nSeconds : ")
time_sec = int(input())
t.sleep(time_sec)
elif time == 'm':
print("Enter minutes seconds you want to wait\nMinutes: ")
time_min = int(input())
time_min * 60
t.sleep(time_min)
elif time = 'h':
print("Enter the number of hours you want to wait\nHours: ")
time_hour = int(input())
time_hour * 3600
t.sleep(time_hour)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question