Nematillo Ochilov
941 subscribers
341 photos
129 videos
383 files
697 links
Buxoro viloyati Gʻijduvon tumanida istiqomat qiluvchi dasturchi, @Nematillo_Ochilov

youtube.com/c/nematilloochilov
@NematilloOchilov - blog
@pythonuz - Python darslari
@js_uz - Java Script
@MQLUZ - Savdo robotlari
@sjtbot - Test kalitlarini tekshirish
Download Telegram
Forwarded from Future Dreams
#py
from datetime import *
def delta(then):
now = datetime.now()
month_days = {
'1': 31,
'2': 28,
'3': 31,
'4': 30,
'5': 31,
'6': 30,
'7': 31,
'8': 31,
'9': 30,
'10': 31,
'11': 30,
'12': 31
}

then = then.split('-')
day = int(then[0])
month = int(then[1])
year = int(then[2])

c_now = now.strftime('%d-%m-%Y').split('-')
c_day = int(c_now[0])
c_month = int(c_now[1])
c_year = int(c_now[2])

d_year = c_year - year
if month > c_month:
d_year -= 1
d_month = c_month + (12 - month)
else:
d_month = c_month - month
old_days = month_days[str(month)]
current_days = month_days[str(c_month)]
if day > c_day:
d_month -= 1
d_day = (old_days - day) + c_day
else:
d_day = c_day - day
if c_year % 4 == 0:
if c_month == 2:
d_day += 1

return '{} yil, {} oy, {} kun'.format(d_year, d_month, d_day)

#Mustaqilligimizdan buyon qancha vaqt o'tganini hisoblab ko'ramiz

print(delta('1-9-1991'))
Forwarded from Future Dreams
#py
"""Siz qmoqchi bo'gan ishni bir qatorda eplasayam bo'ladi.
"""

import random
print([random.choice([a for a in list(range(20)) if a % 2 != 0]) for i in range(5)])
Forwarded from Future Dreams
#py
a = '2&1bda'
a = sorted(a)

print(a) # list

print(''.join(a)) # string