This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from model.player import Player | |
from model.weapon import Weapon | |
knife = Weapon("Couteau", 3) | |
player1 = Player("Graven", 20, 3) | |
# donne un couteau faisant 3 dégats au joueur ! | |
player1.set_weapon(knife) | |
player2 = Player("Bob", 20, 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tp : une fonction pour calculer le nombre de voyelles dans un mot | |
# definir une fonction get_vowels_numbers(mot) | |
def get_voyels_number(word): | |
# créer un compteur de voyelles | |
nb_vowels = 0 | |
# pour chaque lettre du mot vous verifiez s'il s'agit d'un voyelle | |
for letter in ['a','e','i','o','u','y']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importation du randint | |
from random import randint | |
# choisir un nombre aleatoire entre 1 et 1000 | |
just_price = randint(1, 1000) | |
# statut du jeu (activé/désactivé) | |
running = True | |
# tant que le jeu est en cours d'éxécution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import shuffle | |
# Générateur de phrases | |
# demander en console une chaine de la forme "mot1/mot2/mot3/mot4" | |
chained_words = input("Entrer une chaine de la forme mot1/mot2/mot3/mot4") | |
# transformer cette chaine en liste | |
words = chained_words.split("/") | |
# la melanger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place de cinema | |
# recolter l'age de la personne "Quel est votre age ?" | |
age = int(input("Quel est votre age ?")) | |
# si la personne est mineur -> 7€ | |
if age < 18: | |
prix_total = 7 | |
# si la personne est majeur -> 12€ | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# recolter une valeur porte monnaie | |
wallet = int(input("Entrer le nombre d'€ que vous possedez")) | |
print("Vous avez actuellement", wallet, "euros") | |
# creer un produit qui aura pour valeur 50 | |
produit = 50 | |
print("Le Produit vaut ", produit, "euros") | |
# enleve au "wallet" le prix du produit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fichclient = [ | |
[ | |
"ANAP", | |
"ABRI", | |
"PROLAN" | |
], | |
[ | |
"11/04/2003", | |
"10/04/2003", | |
"11/02/2006" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# creation d'une variable "username" ayant pour valeur "carl rossi" | |
username = "carl rossi" | |
# creation d'une variable "age" ayant pour valeur "19" | |
age = 19 | |
# affiche le username et l'age |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fr.gravendev.cyg.utils; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exercice 2 : Calcul de repas | |
Vous mangez 12 semaines par an à la cantine, le prix | |
par repas est de 6€, sachant que vous mangez 3 fois par semaine. | |
Combien devez-vous payer à la fin de chaque année ? |
OlderNewer