fibo terminal

This commit is contained in:
2021-10-11 21:11:33 +02:00
parent 3cacea293e
commit 613a938f51
6 changed files with 49 additions and 5 deletions
Vendored
BIN
View File
Binary file not shown.
+6 -4
View File
@@ -1,11 +1,13 @@
#Pong
#!/usr/bin/env python
"""Début de jeu de pong fait avec baptiste."""
import pygame
pygame.init()
gameDisplay = pygame.display.set_mode((800,600))
pygame.display.set_caption('baptiste')
gameDisplay = pygame.display.set_mode((800, 600))
pygame.display.set_caption("baptiste")
clock = pygame.time.Clock()
running = True
@@ -19,4 +21,4 @@ while running:
print(event)
pygame.display.update()
clock.tick(60)
clock.tick(60)
Regular → Executable
+5 -1
View File
@@ -1,3 +1,7 @@
#!/usr/bin/env python
"""Jeu d'échecs pour le TIPE de thibault."""
from pygame.locals import *
import pygame
import random
@@ -305,4 +309,4 @@ def deep_getsizeof(o, ids=set()):
return r + sum(d(k, ids) + d(v, ids) for k, v in o.iteritems())
if isinstance(o, Container):
return r + sum(d(x, ids) for x in o)
return r
return r
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env python
msgs = {}
n = 1
def process_msg(msg):
global n, msgs
msgs[msg["seq_num"]] = msg
l = []
while n in msgs:
l.append(msgs[n])
del msgs[n]
n += 1
return l
if __name__ == "__main__":
print(process_msg(dict(seq_num=4))) # => [] (4) n=1
print(process_msg(dict(seq_num=2))) # => [] (4,2) n=1
print(process_msg(dict(seq_num=1))) # => [1,2] (4) n=2
print(process_msg(dict(seq_num=3))) # => [3,4] () n=4
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env python
def fibo(n, un1=1, un0=1):
if n <= 1:
return un0
else:
return fibo(n - 1, un1 + un0, un1)
print(fibo(8))
print(fibo(1))
Executable
+4
View File
@@ -0,0 +1,4 @@
##!/usr/bin/env python
# def quicksort(l, a, b):
# if