Outils pour utilisateurs

Outils du site


brouillon_-_python

Ceci est une ancienne révision du document !


Brouillon - Python

Python

Debug

V env

Basic

https://sametmax.com/trier-un-csv-de-5-go/

Assert https://sametmax.com/programmation-par-contrat-avec-assert/

[expression for element in sequence]

[element.upper() for element in sequence] print(['a' * nombre for nombre in sequence]) sequence = [(nombre, list(range(nombre))) for nombre in sequence]

if is_ok:
    print(welcome)
else:
    print(error)
 
print(welcome if is_ok else error)

lambda

Other module

from itertools import groupby from collections import defaultdict

Doc

pydoc  en format texte python3 -m pydoc mon_module python3 -m pydoc mon_module.ma_fonction  en format html python3 -m pydoc -w mon_module python3 -m pydoc -w mon_module.ma_fonction

IPython

python3 -m IPython

POO

Les dataclasses

Voir https://sametmax.com/python-3-7-sort-de-sa-coquille/

from dataclasses import dataclass @dataclass class Achat:

  produit: str
  prix: float
  quantite: int = 0
  

Trio

Linter / Formater

IDE

Autres

import sys
import math
from contextlib import redirect_stdout
 
 
def compute_join_point(s_1, s_2):
    # Write your code here
    # To debug: print("Debug messages...", file=sys.stderr, flush=True)
 
    return 0
 
# Ignore and do not change the code below
def main():
    s_1 = int(input())
    s_2 = int(input())
    with redirect_stdout(sys.stderr):
        res = compute_join_point(s_1, s_2)
    print(res)
 
if __name__ == "__main__":
    main()
 
import sys
import math
from contextlib import redirect_stdout
 
 
def find_network_endpoint(start_node_id, from_ids, to_ids):
    # Write your code here
    # To debug: print("Debug messages...", file=sys.stderr, flush=True)
 
    return 0
 
# Ignore and do not change the code below
def main():
    start_node_id = int(input())
    n = int(input())
    #from_ids = [int(i) for i in input().split()]
    #to_ids = [int(i) for i in input().split()]
    from_ids = [1 7 3 4 2 6 9]
    to_ids = [3 3 4 6 6 9 5]
    with redirect_stdout(sys.stderr):
        endPointId = find_network_endpoint(start_node_id, from_ids, to_ids)
    print(end_point_id)
 
if __name__ == "__main__":
    main()
 
1 7 3 4 2 6 9
3 3 4 6 6 9 5
--------------------------

Touch file

open(new_file_path, "wb").close()  # create new file in working tree
brouillon_-_python.1749135086.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki