#! /usr/bin/python
# -*- coding: utf-8 -*-

#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
#
"""Fonctions de base.
Auteur: Mettre votre nom
Date: 19-09-2024
"""

######################################
# Import des fonctions de maths      #
######################################

from math import *

######################################
# Algorithme 0:                      #
# Exemple de commandes utiles        #
######################################


a = 34 # a vaut 24
b = 5 # b vaut 5
c = a // b # c vaut le quotient de la division euclidienne de a par b, c'est a dire 6
d = a % b  # d vaut le reste de la division euclidienne de a par b, c'est a dire 4
a = (a**2+b**2)**0.5 # a vaut maintenant racine de (a^2 + b^2)

for i in range(10):
    print(i) # affiche les 10 premiers entiers en partant de 0

for i in range(10):
    print("Bonjour élève numéro " + str(i)) # affiche une concatenation d'une chaine et d'un nombre

def Bonjour(nom):
    '''cette fonction affiche bonjour suivi du nom entre'''
    return "Bonjour " + nom

# je teste ma fonction
print(Bonjour("Toto"))

def SommeProd(a,b):
    '''cette fonction renvoie la somme et le produuit de a et b'''
    return a+b, a*b

# je teste ma fonction
print(SommeProd(5,2))

# voila une fonction qui calcule des termes successifs de suite u_n définie par u_{n+1} = 3*u_n +2 et u_0=1
def Suite(n):
    '''calcul du terme de rang n d'une suite'''
    u = 1
    for i in range(n):
        u = 3*u+2
    return u

# je teste ma fonction.
print(Suite(4))


######################################
# Algorithme 1:                      #
# Conversion temps                   #
######################################


######################################
# Algorithme 2:                      #
# Conversion temps                   #
######################################


######################################
# Algorithme 3:                      #
# Pour les enfants                   #
######################################


######################################
# Algorithme 4:                      #
# Pour les enfants                   #
######################################


######################################
# Algorithme 5:                      #
# Resolution d'equations             #
######################################


######################################
# Algorithme 6:                      #
# Resolution d'equations             #
######################################


######################################
# Algorithme 7:                      #
# Fonction pour la geometrie         #
######################################


######################################
# Algorithme 8:                      #
# Fonction pour la geometrie         #
######################################


######################################
# Algorithme 9:                      #
# Fonction bancaire                  #
######################################


######################################
# Algorithme 10:                     #
# Fonction bancaire                  #
######################################


######################################
# Algorithme 11:                     #
# Fonction bancaire                  #
######################################


######################################
# Algorithme 12:                     #
# Fonction bancaire                  #
######################################


