Vii. Sana va vaqt bilan ishlash


Download 21.66 Kb.
bet6/6
Sana28.10.2023
Hajmi21.66 Kb.
#1732373
1   2   3   4   5   6
Bog'liq
python time

Sanalarni solishtirish


Satrlar va sonlar kabi sanani ham standart taqqoslash amallari yordamida solishtirish mumkin:

1

from datetime import datetime


2
3
4
5
6
7
8 9
10
11
12

now = datetime.now()
deadline = datetime(2019, 5, 22) if now > deadline:
print("Dasturni topshirish muddati o'tdi") elif now.day == deadline.day and now.month == deadline.month and now.year == deadline.year: print("Bugun dasturni topshirish muddati") else:
period = deadline - now
print("Qoldi {} kun".format(period.days))

Download 21.66 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling