Bienvenue

Dans cette section, vous trouverez des ressources sur les cours que j'enseigne à savoir de la documentation, du code, des vidéos etc. Dès que je trouve quelque chose d'intéressant à partager, je le mettrai à disposition ici pour mes étudiants.


Devoir 1 - Groupe 0001.

Programme 1 : Écrire un programme qui calcule le cout de l’abonnement de chaque adhérent à un club de conditionnement physique.

Groupe 0001

		##Auteur : Enseignant
		##École : Collège Marie Victorin 
		##Session : Automne 2023
		##Titre du cours : Introduction à la programmation avec Python
		##Titre du programme : devoir1_prog1.py
		##Courte description du programme : Programme qui calcule le cout d'un abvonnement à un club de conditionnement physique.
		##Version : 1.0
		##Date : 00/00/2023
		##Langage et version : Python - 3.11
		##Règles de fonctionnement du programme :
		##
		##=============================================================================

		## Déclaration des chaines de caractères
		strTitreProgramme = 'Programme de gestion des abonnements'
		strSouligne = '*' * len(strTitreProgramme)
		strNomClub = 'Club du Coin inc.'
		strTelephoneClub = '514-111-2222'
		strSiteWeb = 'Site web : http://www.clubducoin.com'

		strPromptNom = 'Veuillez entrer le nom de l\'adhérent : '
		strSaisieNom = ''
		strPromptType = 'Veuillez entrer le type d\'abonnement (A, E, V) : '
		strTypeAbonnement = ''
		strErreurAbonnement = 'Erreur. Type d\'abonnement invalide'

		strMsgSortieAbonnement = 'Le prix de l\'abonnement {} de {} est : {:.2f} $'
		strMsgSortieReduction = '{:.2%} de réduction pour {}.'

		strTypeAbonnementA = 'A'
		strTypeAbonnementE = 'E'
		strTypeAbonnementV = 'V'

		## Déclaration des variables numériques
		flPrixAbonnementAnnuel = 500.00
		flPrixAbonnementFinal = 0.00
		flReductionA = 0.00
		flReductionE = 0.09
		flReductionV = 0.15
		flReduction = 0.00
		flTaxes = 0.145
		flMontantReduction = 0.0
		flMontantTaxes = 0.0
		flMontantApresReduction = 0.0

		## Début du programme

		strSaisieNom = input(strPromptNom)
		strTypeAbonnement = input(strPromptType)

		if (strTypeAbonnement != strTypeAbonnementA) and (strTypeAbonnement != strTypeAbonnementE) and (strTypeAbonnement != strTypeAbonnementV):
			print(strErreurAbonnement)
		else:    
			if strTypeAbonnement == strTypeAbonnementA:
				flReduction = flReductionA
				flMontantReduction = flPrixAbonnementAnnuel * flReduction
				flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
				flMontantantTaxes = flMontantApresReduction * flTaxes
				flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes

				
			elif strTypeAbonnement == strTypeAbonnementE:
				flReduction = flReductionE
				flMontantReduction = flPrixAbonnementAnnuel * flReduction
				flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
				flMontantantTaxes = flMontantApresReduction * flTaxes
				flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes

			elif strTypeAbonnement == strTypeAbonnementV:
				flReduction = flReductionV
				flMontantReduction = flPrixAbonnementAnnuel * flReduction
				flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
				flMontantantTaxes = flMontantApresReduction * flTaxes
				flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes

			## Affichage des données de l'abonnement
			print(strMsgSortieAbonnement.format(strTypeAbonnement, strSaisieNom, flPrixAbonnementFinal))

			## Affichage du pourcentage du rabais
			print(strMsgSortieReduction.format(flReduction, strSaisieNom))
		  
	  

Programme 1 : Écrire un programme qui calcule le cout de l’abonnement de chaque adhérent à un club de conditionnement physique.

Version 2

		##Auteur : Enseignant
		##École : Collège Marie Victorin 
		##Session : Automne 2023
		##Titre du cours : Introduction à la programmation avec Python
		##Titre du programme : devoir1_prog1.py
		##Courte description du programme : Programme qui calcule le cout d'un abvonnement à un club de conditionnement physique.
		##Version : 1.0
		##Date : 00/00/2023
		##Langage et version : Python - 3.11
		##Règles de fonctionnement du programme :
		##
		##=============================================================================

		## Déclaration des chaines de caractères
		strTitreProgramme = 'Programme de gestion des abonnements'
		strSouligne = '*' * len(strTitreProgramme)
		strNomClub = 'Club du Coin inc.'
		strTelephoneClub = '514-111-2222'
		strSiteWeb = 'Site web : http://www.clubducoin.com'

		strPromptNom = 'Veuillez entrer le nom de l\'adhérent : '
		strSaisieNom = ''
		strPromptType = 'Veuillez entrer le type d\'abonnement (A, E, V) : '
		strTypeAbonnement = ''
		strErreurAbonnement = 'Erreur. Type d\'abonnement invalide'

		strMsgSortieAbonnement = 'Le prix de l\'abonnement {} de {} est : {:.2f} $'
		strMsgSortieReduction = '{:.2%} de réduction pour {}.'

		strTypeAbonnementA = 'A'
		strTypeAbonnementE = 'E'
		strTypeAbonnementV = 'V'

		## Déclaration des variables numériques
		flPrixAbonnementAnnuel = 500.00
		flPrixAbonnementFinal = 0.00
		flReductionA = 0.00
		flReductionE = 0.09
		flReductionV = 0.15
		flReduction = 0.00
		flTaxes = 0.145
		flMontantReduction = 0.0
		flMontantTaxes = 0.0
		flMontantApresReduction = 0.0

		## Début du programme

		strSaisieNom = input(strPromptNom)
		strTypeAbonnement = input(strPromptType)

		if (strTypeAbonnement != strTypeAbonnementA) and (strTypeAbonnement != strTypeAbonnementE) and (strTypeAbonnement != strTypeAbonnementV):
			print(strErreurAbonnement)
		else:    
			if strTypeAbonnement == strTypeAbonnementA:
				flReduction = flReductionA
				
			elif strTypeAbonnement == strTypeAbonnementE:
				flReduction = flReductionE

			elif strTypeAbonnement == strTypeAbonnementV:
				flReduction = flReductionV

			## Calcul des montants
			flMontantReduction = flPrixAbonnementAnnuel * flReduction
			flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
			flMontantantTaxes = flMontantApresReduction * flTaxes
			flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes


			## Affichage des données de l'abonnement
			print(strMsgSortieAbonnement.format(strTypeAbonnement, strSaisieNom, flPrixAbonnementFinal))

			## Affichage du pourcentage du rabais
			print(strMsgSortieReduction.format(flReduction, strSaisieNom))
      

Programme 2 : Modifier le programme 1 afin qu'il exécute un certain nombre d'abonnement fourni par l'utilisateur

Demander à l’utilisateur d’entrer le nombre d'abonnements qu'il désire enregistrer puis afficher le chiffre d'affaires.

Version 1

		##Auteur : Enseignant
		##École : Collège Marie Victorin 
		##Session : Automne 2023
		##Titre du cours : Introduction à la programmation avec Python
		##Titre du programme : devoir1_prog1.py
		##Courte description du programme : Programme qui calcule le cout d'un abvonnement à un club de conditionnement physique.
		##Version : 1.0
		##Date : 00/00/2023
		##Langage et version : Python - 3.11
		##Règles de fonctionnement du programme :
		##
		##=============================================================================

		## Déclaration des chaines de caractères
		strTitreProgramme = 'Programme de gestion des abonnements'
		strSouligne = '*' * len(strTitreProgramme)
		strNomClub = 'Club du Coin inc.'
		strTelephoneClub = '514-111-2222'
		strSiteWeb = 'Site web : http://www.clubducoin.com'

		strPromptNom = '\nVeuillez entrer le nom de l\'adhérent : '
		strSaisieNom = ''
		strPromptType = 'Veuillez entrer le type d\'abonnement (A, E, V) : '
		strTypeAbonnement = ''
		strErreurTypeAbonnement = 'Erreur. Type d\'abonnement invalide'
		strPromptNbAbonnement = 'Entrer le nombre d\'abonnement à traiter : '
		strErreurNombreAbonnment = 'Erreur. Nombre d\'abonnements invalide'

		strMsgSortieAbonnement = '\nLe prix de l\'abonnement {} de {} est : {} $'
		strMsgSortieReduction = '{:.2%} de réduction pour {}.'
		strMsgSortieChiffreAffaires = '\nLe chiffre d\'affaires pour les {} abonnements est {} $'

		strTypeAbonnementA = 'A'
		strTypeAbonnementE = 'E'
		strTypeAbonnementV = 'V'

		## Déclaration des variables numériques
		flPrixAbonnementAnnuel = 500.00
		flPrixAbonnementFinal = 0.00
		flReductionA = 0.00
		flReductionE = 0.09
		flReductionV = 0.15
		flReduction = 0.00
		flTaxes = 0.145

		## Déclaration pour le chiffre d'affaires
		intNombreAbonnement = 0
		intLimiteAbonnement = 5
		flChiffreAffaires = 0.00

		## Début du programme

		## Saisie du nombre d'abonnements
		intNombreAbonnement = int(input(strPromptNbAbonnement))

		## Vérification du nombre d'abonnements
		if intNombreAbonnement < 0 or intNombreAbonnement > intLimiteAbonnement:
			print(strErreurNombreAbonnment)
		else:    
			for indice in range(intNombreAbonnement):
				strSaisieNom = input(strPromptNom)
				strTypeAbonnement = input(strPromptType)

				if (strTypeAbonnement != strTypeAbonnementA) and (strTypeAbonnement != strTypeAbonnementE) and (strTypeAbonnement != strTypeAbonnementV):
					print(strErreurAbonnement)
				else:

					if strTypeAbonnement == strTypeAbonnementA:
							flReduction = flReductionA
							flMontantReduction = flPrixAbonnementAnnuel * flReduction
							flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
							flMontantantTaxes = flMontantApresReduction * flTaxes
							flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes
							
					elif strTypeAbonnement == strTypeAbonnementE:
							flReduction = flReductionE
							flMontantReduction = flPrixAbonnementAnnuel * flReduction
							flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
							flMontantantTaxes = flMontantApresReduction * flTaxes
							flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes

					elif strTypeAbonnement == strTypeAbonnementV:
							flReduction = flReductionV
							flMontantReduction = flPrixAbonnementAnnuel * flReduction
							flMontantApresReduction = flPrixAbonnementAnnuel - flMontantReduction
							flMontantantTaxes = flMontantApresReduction * flTaxes
							flPrixAbonnementFinal = flMontantApresReduction + flMontantantTaxes

				## Calcul du chiffre d'affaires et affichage des abonnements
				flChiffreAffaires = flChiffreAffaires + flPrixAbonnementFinal
				## print(strMsgSortieAbonnement.format(strTypeAbonnement, strSaisieNom, flPrixAbonnementFinal))

				## Affichage du pourcentage du rabais
				print(strMsgSortieReduction.format(flReduction, strSaisieNom))

			## Affichage du chiffre d'affaires
			print(strMsgSortieChiffreAffaires.format(indice + 1, flChiffreAffaires))		
      

W3schools

Python.org