Skip to content

Python codes and news

Open Menu
February 8, 2012

Obtenir la plus grande et la plus petite valeur d’une liste

Obtenir la plus grande et la plus petite valeur d'une liste
       

table = [14, 34, 78, -9,  60, 678]

print len(table)     # Nombre d'élément dans la table

user
February 8, 2012

Python: Obtenir le modulo

Python: Obtenir le modulo
       
print "Modulo"
print 5 % 2



           
              
user
February 8, 2012

Arrondir un nombre

Arrondir un nombre
       

num = 6 / 7.0
print num 
print round(num)

           
              
user
February 8, 2012

Utilisation des Fonctions ‘abs()’ et ‘pow()’

Utilisation des Fonctions 'abs()' et 'pow()'
       

import math

print abs(-16)   # Obtenir la valeur absolue
print pow(2, 4)  # Obtenir la pui
user
February 8, 2012

La fonction trigonométrique ‘cos()’

La fonction trigonométrique 'cos()'
   

import math

# Le logarithme naturel
print math.log(1024, 2)


           
              
user
February 8, 2012

Fonction de comparaison ‘max()’

Fonction de comparaison 'max()'
# Trouver la valeur maximale
# des arguments
print max(2, 3, 78, -100, 24)


           
          
user
February 8, 2012

Fonction de comparaison ‘min()’

Fonction de comparaison 'min()'
       
# Trouver la valeur maximale
# des arguments
print min(2, 3, 78, -100, 24)

           
    
user
February 8, 2012

Afficher la valeur arrondie d’un chiffre

Afficher la valeur arrondie d'un chiffre
       
x = 3
y = 4

print y / (2.0 + x)

           
              
user
February 8, 2012

Exemple d’utilisation des fonctions ‘atan()’ et ‘atan2()’

Exemple d'utilisation des fonctions 'atan()' et 'atan2()'
import math

print math.atan(-1./-1.)

print math.atan2(-1., -1.)


   
         
user
February 8, 2012

Obtenir la racine carrée d’un nombre

Obtenir la racine carrée d'un nombre
       

from math import sqrt

for x in range(99, 0, -1):
    root = sqrt(x)
    if root == int(roo
user

Posts navigation

Older posts
Newer posts

Recent Posts

  • Hello world!
  • Python: Remplacer une chaîne de caractères par une autre
  • Installer Python Sur NetBeans 7.3
  • Python: Partager un dossier dans le réseaux
  • Python: Vérifier si la carte son est bien configurée

Recent Comments

  1. A WordPress Commenter on Hello world!
© 2025 Python codes and news
 / Theme: Really Simple / License: GPLv3