<jupyter_start><jupyter_text><jupyter_code>import calendar

c = calendar.TextCalendar(calendar.MONDAY)
c.prmonth(2020, 9)
import calendar
import pprint

pprint.pprint(calendar.monthcalendar(2020, 9))
import calendar

# Show every month
for month in range(1, 13):

    # Compute the dates for each week that overlaps the month
    c = calendar.monthcalendar(2020, month)
    first_week = c[0]
    second_week = c[1]
    third_week = c[2]

    # If there is a Thursday in the first week, the second Thursday (jeudi)
    # is in the second week.  Otherwise the second Thursday must 
    # be in the third week.
    if first_week[calendar.THURSDAY]:
        meeting_date = second_week[calendar.THURSDAY]
    else:
        meeting_date = third_week[calendar.THURSDAY]

    print('%3s: %2s' % (month, meeting_date))
import calendar
import pprint

# Calling yeardays2calendar(2007, 2) returns data for 2007, organized with 2 months per row.

pprint.pprint(calendar.Calendar(calendar.MONDAY).yeardays2calendar(2020, 1))
# Python code to print Calendar 
# Without use of Calendar module 

mm = 9
yy = 2020

month ={1:'January', 2:'February', 3:'March', 
		4:'April', 5:'May', 6:'June', 7:'July', 
		8:'August', 9:'September', 10:'October', 
		11:'November', 12:'December'} 

# code below for calculation of odd days 
day =(yy-1)% 400
day = (day//100)*5 + ((day % 100) - (day % 100)//4) + ((day % 100)//4)*2
day = day % 7

nly =[31, 28, 31, 30, 31, 30, 
	31, 31, 30, 31, 30, 31] 
ly =[31, 29, 31, 30, 31, 30, 
	31, 31, 30, 31, 30, 31] 
s = 0

if yy % 4 == 0: 
	for i in range(mm-1): 
		s+= ly[i] 
else: 
	for i in range(mm-1): 
		s+= nly[i] 

day += s % 7
day = day % 7

# variable used for white space filling 
# where date not present 
space ='' 
space = space.rjust(2, ' ') 

# code below is to print the calendar 
print(month[mm], yy) 
print('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa') 

if mm == 9 or mm == 4 or mm == 6 or mm == 11: 
	for i in range(31 + day): 
		
		if i<= day: 
			print(space, end =' ') 
		else: 
			print("{:02d}".format(i-day), end =' ') 
			if (i + 1)% 7 == 0: 
				print() 
elif mm == 2: 
	if yy % 4 == 0: 
		p = 30
	else: 
		p = 29
		
	for i in range(p + day): 
		if i<= day: 
			print(space, end =' ') 
		else: 
			print("{:02d}".format(i-day), end =' ') 
			if (i + 1)% 7 == 0: 
				print() 
else: 
	for i in range(32 + day): 
		
		if i<= day: 
			print(space, end =' ') 
		else: 
			print("{:02d}".format(i-day), end =' ') 
			if (i + 1)% 7 == 0: 
				print() 

# Python program to print calendar for given year 

# importing calendar library 
import calendar 

def printcalendar(year): 	
	# printing calendar 
	print(calendar.calendar(year)) 

# driver program to test above function 
year = 2020
printcalendar(year) 
year = 2021
printcalendar(year) 

# Python program to demonstrate working 
# of itermonthdays() method 

# importing calendar module 
import calendar 

year = 2020
mnth = 9


obj = calendar.Calendar() 

# iteratign with itermonthdays 
for day in obj.itermonthdays(year, mnth): 
	print(day) 

# Python program to demonstrate working 
# of monthdayscalendar() method 

# importing calendar module 
import calendar 

obj = calendar.Calendar() 

year = 2020
mnth = 9

# priting with monthdayscalendar 
print(obj.monthdayscalendar(year, mnth)) 

# Python program to demonstrate working 
# of yeardayscalendar() method 

# importing calendar module 
import calendar 
import pprint

obj = calendar.Calendar() 

year = 2020
# default value of width is 3 

# priting with yeardayscalendar 
pprint.pprint(obj.yeardayscalendar(year))<jupyter_output><empty_output><jupyter_text>setfirstweekday() définit le jour de la semaine (0 est lundi, 6 est dimanche) pour démarrer chaque semaine. Les valeurs LUNDI, MARDI, MERCREDI, JEUDI, VENDREDI, SAMEDI et DIMANCHE sont fournies pour des raisons de commodité.<jupyter_code># Python program to demonstrate working of 
# monthdays2calendar() method 

# importing calendar module 
import calendar 

obj = calendar.Calendar() 

# iteratign with monthdays2calendar 
for day in obj.monthdays2calendar(2020, 9): 
	print(day) 

# Python code to demonstrate the working of 
# setfirstweekday() with prmonth() method 

# importing calendar module for calendar operations 
import calendar 

# using prmonth() to print calendar of 1997 
print ("The 4th month of 1997 is : ") 
calendar.prmonth(2020, 9, 2, 1) 


# using setfirstweekday() to set first week day number 
calendar.setfirstweekday(1) 

print ("\r") 

# using firstweekday() to check the changed day 
print ("The new week day number is : ", end ="") 
print (calendar.firstweekday()) 

documents = {
    1: "a donut on a glass plate",
    2: "only the donut",
    3: "listen to the drum machine",
}

index = {
    "a": [1],
    "donut": [1, 2],
    "on": [1],
    "glass": [1],
    "plate": [1],
    "only": [2],
    "the": [2, 3],
    "listen": [3],
    "to": [3],
    "drum": [3],
    "machine": [3],
}

%timeit print(index)<jupyter_output><empty_output><jupyter_text>https://openclassrooms.com/fr/courses/235344-apprenez-a-programmer-en-python/234239-faites-de-la-programmation-systeme<jupyter_code>!pip install num2words<jupyter_output>Collecting num2words
[?25l  Downloading https://files.pythonhosted.org/packages/eb/a2/ea800689730732e27711c41beed4b2a129b34974435bdc450377ec407738/num2words-0.5.10-py3-none-any.whl (101kB)

[K     |███▎                            | 10kB 15.9MB/s eta 0:00:01
[K     |██████▌                         | 20kB 6.4MB/s eta 0:00:01
[K     |█████████▊                      | 30kB 5.5MB/s eta 0:00:01
[K     |█████████████                   | 40kB 6.1MB/s eta 0:00:01
[K     |████████████████▏               | 51kB 6.2MB/s eta 0:00:01
[K     |███████████████████▍            | 61kB 6.9MB/s eta 0:00:01
[K     |██████████████████████▋         | 71kB 7.7MB/s eta 0:00:01
[K     |█████████████████████████▉      | 81kB 8.0MB/s eta 0:00:01
[K     |█████████████████████████████   | 92kB 7.8MB/s eta 0:00:01
[K     |████████████████████████████████| 102kB 5.0MB/s 
[?25hRequirement already satisfied: docopt>=0.6.2 in /usr/local/lib/python3.6/dist-packages (from num2words) (0.6.2)
Installing collected[...]<jupyter_text>Besides the numerical argument, there are two main optional arguments.**to**: The converter to use. Supported values are:* cardinal (default)* ordinal* ordinal_num* year* currency<jupyter_code>from num2words import num2words

print(num2words(42))
print(num2words(42, to='ordinal'))

print(num2words(90, lang='fr'))
print(num2words(90, lang='fr_CH'))
print(num2words(90, lang='fr_CH', to='ordinal'))


import signal
import sys

def fermer_programme(signal, frame):
    """Fonction appelée quand vient l'heure de fermer notre programme"""
    print("C'est l'heure de la fermeture !")
    sys.exit(0)

# Connexion du signal à notre fonction
signal.signal(signal.SIGINT, fermer_programme)

# Notre programme...
print("Le programme va boucler...")
while True:
    continue<jupyter_output>Le programme va boucler...
C'est l'heure de la fermeture !
StarcoderdataJupyterStructuredCleanDedup