Python Programming using Unicode

Code काहीनाही = None लिहा = print class सूर: def __init__(स्वतः, नाव): स्वतः.नाव = नाव स्वतः._वाहन = काहीनाही def माहिती(स्वतः): return {'नाव': स्वतः.नाव, 'वाहन': स्वतः.वाहन} @property def वाहन(स्वतः): return स्वतः._वाहन @वाहन.setter def वाहन(स्वतः, मूल्य): स्वतः._वाहन = मूल्य अनेक_सूर = [ सूर('पार्वती') सूर('गणपती'), सूर('शंकर'), सूर('कार्तिक') ] अनेक_सूर[0].वाहन = 'वाघ' अनेक_सूर[1].वाहन = 'मूषक' अनेक_सूर[2].वाहन = 'बैल' अनेक_सूर[3].वाहन = 'मोर' for एक_सूर in अनेक_सूर: लिहा(एक_सूर.नाव, '->', एक_सूर.वाहन) लिहा(एक_सूर.माहिती()) Output पार्वती -> वाघ {'नाव': 'पार्वती', 'वाहन': 'वाघ'} गणपती -> मूषक {'नाव': 'गणपती', 'वाहन': 'मूषक'} शंकर -> बैल {'नाव': 'शंकर', 'वाहन': 'बैल'} कार्तिक -> मोर {'नाव': 'कार्तिक', 'वाहन': 'मोर'}

जानेवारी 16, 2023 · 1 min · 94 words · शंतनू

Code Quality

एप्रिल 18, 2015 · 0 min · 0 words · शंतनू

Tao of Programming

The Silent Void Thus spake the master programmer: “When you have learned to snatch the error code from the trap frame, it will be time for you to leave.” 1.1 Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming....

जुलै 21, 2014 · 17 min · 3497 words · शंतनू

Fizz Buzz

Problem: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. f = lambda x: 'FizzBuzz' if not (x%5 or x%3) else 'Fizz' if not x%3 else 'Buzz' if not x%5 else str(x) for x in range(100): print(f(x)) Fizz Buzz problem

एप्रिल 22, 2014 · 1 min · 73 words · शंतनू

Using timezone with datetime in python

>>> import pytz >>> import datetime >>> tz = pytz.timezone('Asia/Calcutta') >>> tz <DstTzInfo 'Asia/Calcutta' HMT+5:53:00 STD> >>> t = tz.localize(datetime.datetime(2014, 4, 5, 6, 7, 8, 900)) >>> t datetime.datetime(2014, 4, 5, 6, 7, 8, 900, tzinfo=<DstTzInfo 'Asia/Calcutta' IST+5:30:00 STD>) >>> t.isoformat() '2014-04-05T06:07:08.000900+05:30' Reference: Python datetime object show wrong timezone offset

एप्रिल 5, 2014 · 1 min · 50 words · शंतनू