2018年1月9日 星期二

Python: Convert all units of time into seconds

Python: Convert all units of time into seconds

Python Basic: Exercise-62 with Solution

Write a Python program to convert all units of time into seconds.
Sample Solution:-
days = int(input("Input days: ")) * 3600 * 24
hours = int(input("Input hours: ")) * 3600
minutes = int(input("Input minutes: ")) * 60
seconds = int(input("Input seconds: "))
time = days + hours + minutes + seconds
print("The  amounts of seconds", time)

=========== RESTART: F:/Python_APSC/py-ex-basic-62.py ===========
Input days: 3
Input hours: 12
Input minutes: 50
Input seconds: 2
The  amounts of seconds 305402
>>> 

沒有留言:

張貼留言

Node-Red --> MQTT --> Fuxa 開源碼網頁式圖控平台

Node-Red --> MQTT --> Fuxa      FUXA(一個開源的 Web HMI / SCADA 自動化監控軟體)的專案設定檔 。 這份設定檔完整定義了 HMI 監控畫面的 後端通訊(MQTT 連線、點位標籤) 與 前端網頁圖形介面(SVG 畫布...