tools.py

Created by gengisclan

Created on November 23, 2022

1.63 KB

Pas mal d’outils au cas où


# Createur: Gengisclan
# Derniere MaJ: 09/11/2022, 11:18
# Merci du soutient !

from math import *
from turtle import *
from ion import *
from kandinsky import *
from matplotlib.pyplot import *


def MiseA20(a,b):# Note,total
  c=a/b*20
  return str(c)+"/20"


def Dessin(a):# Assez fun avec un(e) petit(e)
  pensize(a);penup();goto(0,0)
  while 1:
    if keydown(KEY_UP):setheading(90);forward(1)
    if keydown(KEY_DOWN):setheading(-90);forward(1)
    if keydown(KEY_RIGHT):setheading(0);forward(1)
    if keydown(KEY_LEFT):setheading(180);forward(1)
    if keydown(KEY_OK):pendown()
    if not keydown(KEY_OK):penup()
    if keydown(KEY_EXE):goto(0,0)

def Moyenne(a):# Liste av toutes les notes /20
  d=0;c=0      # Coef en manuel
  for i in range(len(a)):
    c+=a[0+d];d+=1
  return c/len(a)


def Point_SCRABBLE(mot):# Attention guillemets
  valeurs_scrabble ={10 : 'kwxyz', 8 : 'jq', 4 : 'fhv' , 3 : 'bcp' , 2: 'dmg' ,1 : 'aeilnorstu'}
  dico_score_lettre = {}
  for key, value in valeurs_scrabble.items():
    for lettre in value :
      dico_score_lettre[lettre] = key
  point=0
  for i in mot:
    point+=dico_score_lettre[i]
  return mot+" vaut "+str(point)+" points"


def Sep_chiffres(n):# Tjs utile quand t'a la flemme 
  c=""
  n2=str(int(n))
  for i in range(len(n2)/3):
    c=" "+n2[-3:]+c
    n2=n2[0:-3]
  return c[1:]


def Lampe():# Preferable lum au max
  b=color(0,0,0)
  set_pixel(0,0,b)
  
  
def graph_hexa(h):# Ne sert a rien
  axis((0,1000,0,1000))# GG a ceux qui savent 
  show()
  grid()
  x=0
  n="0x"+str(h)
  while not n=="0x":
    print("(",n[2:],")16 vaut (",int(n),")10")
    scatter(x,int(n))
    n=n[0:-1]
    x+=1

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.