Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"workbench.colorTheme": "Default Light+",
"workbench.colorTheme": "Default Dark Modern",
"notebook.lineNumbers": "on",
"files.encoding": "utf8",
"java.inlayHints.parameterNames.enabled": "none",
Expand Down
2 changes: 1 addition & 1 deletion Python/04 Funcions/Teoria.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.12.3"
},
"orig_nbformat": 4
},
Expand Down
2 changes: 1 addition & 1 deletion Python/06 Control de fluxe (if else)/Teoria.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.12.3"
},
"orig_nbformat": 4
},
Expand Down
2 changes: 1 addition & 1 deletion Python/08 Bucles (while for)/A while.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.12.3"
},
"orig_nbformat": 4
},
Expand Down
38 changes: 31 additions & 7 deletions Python/11 Dades/A Llistes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"El producte a la posicó 1 és: ['Escombra', 5.49]\n",
"El nom del producte a la posicó 1 és: Escombra\n",
"El preu del producte a la posicó 1 és: 5.49\n"
]
}
],
"source": [
"# Exemple d'accedir a les posicions d'una matriu:\n",
"productes = [\n",
Expand All @@ -549,9 +559,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"El producte 'Fregona' costa 10.99 €\n",
"El producte 'Escombra' costa 5.49 €\n",
"El producte 'Galleda' costa 8.95 €\n",
"El producte 'Drap' costa 2.99 €\n",
"El producte 'Fregall' costa 6.75 €\n",
"Suma total: 35.17\n",
"Mitjana: 7.03\n"
]
}
],
"source": [
"# Exemple d'escriure una elements d'una matriu\n",
"productes = [\n",
Expand Down Expand Up @@ -602,7 +626,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -774,7 +798,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.12.3"
},
"orig_nbformat": 4
},
Expand Down
2 changes: 1 addition & 1 deletion Python/11 Dades/B Llistes avançades.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
"version": "3.12.3"
},
"orig_nbformat": 4
},
Expand Down
2 changes: 1 addition & 1 deletion Python/50 Dibuix/Teoria.ipynb

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions Python/50 Dibuix/exemple003.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
def main():
global font, text, image

is_looping = True

# Definir el text
font = pygame.font.SysFont("Arial", 55)
is_looping = Truetext = font.render('Hello Arial!', True, BLACK)
text = font.render('Hello Arial!', True, BLACK)

# Carregar la imatge
Expand Down
74 changes: 74 additions & 0 deletions Python/50 Dibuix/exercici_matriu_sgd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import math
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
import sys
import utils
import random

# Definir colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
PURPLE = (128, 0, 128)
ORANGE = (255, 165, 0)

pygame.init()
clock = pygame.time.Clock()

font = pygame.font.SysFont("Arial", 55)
#Matriz
matriz = [[str(random.randint(1,9)) for _ in range(10)] for _ in range(10)]


# Definir la finestra
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Window Title')

# Bucle de l'aplicació
def main():
is_looping = True

while is_looping:
is_looping = app_events()
app_run()
app_draw()

clock.tick(60) # Limitar a 60 FPS

# Fora del bucle, tancar l'aplicació
pygame.quit()
sys.exit()

# Gestionar events
def app_events():
for event in pygame.event.get():
if event.type == pygame.QUIT: # Botó tancar finestra
return False
return True

# Fer càlculs
def app_run():
pass

# Dibuixar
def app_draw():
# Pintar el fons de blanc
screen.fill(WHITE)

# Dibuixar la graella de coordenades (llibreria utils)
utils.draw_grid(pygame, screen, 50)

# Actualitzar el dibuix a la finestra
pygame.display.update()

text = font.render('Hello Arial!', True, BLACK)

#Mostrar Texto
screen.blit(text, (50, 50))

if __name__ == "__main__":
main()

71 changes: 71 additions & 0 deletions Python/52 Deures D0/Ejercicio0_pygame_Steephen_Garcia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
###Ejercicio 0###
import math
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
import sys
import utils

# Definir colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GRAY = (200, 200, 200)
PINK = (255, 105, 180)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)

pygame.init()
clock = pygame.time.Clock()

# Definir la finestra
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Window Title')

# Bucle de l'aplicació
def main():
is_looping = True

while is_looping:
is_looping = app_events()
app_run()
app_draw()

clock.tick(60) # Limitar a 60 FPS

# Fora del bucle, tancar l'aplicació
pygame.quit()
sys.exit()

# Gestionar events
def app_events():
for event in pygame.event.get():
if event.type == pygame.QUIT: # Botó tancar finestra
return False
return True

# Fer càlculs
def app_run():
pass

# Dibuixar
def app_draw():
screen.fill(WHITE)
utils.draw_grid(pygame, screen, 50)

#Cuadrado rosa
pygame.draw.rect(screen, PINK, (150, 200, 50, 50), 5)

#Triangulo verde
pygame.draw.polygon(screen, GREEN, [(275, 200), (275 - 28, 248), (275 + 28, 248)], 5)

#Cruz Azul
pygame.draw.line(screen, BLUE, (350, 200), (400, 250), 6)
pygame.draw.line(screen, BLUE, (350, 250), (400, 200), 6)

#Redonda roja
pygame.draw.circle(screen, RED, (475, 225), 25, 5)

pygame.display.update()
if __name__ == "__main__":
main()