Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:completed risk-risiko #147

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lorenzodidomenic
Copy link

No description provided.

print("Giocatore1 ha vinto")
else:
print("Giocatore2 ha vinto")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potresti implementare qualche funzione

src/ex6.py Outdated
Comment on lines 43 to 46
if counterGiocatore1>=counterGiocatore2:
print("Giocatore1 ha vinto")
else:
print("Giocatore2 ha vinto")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qui c'è una ridondanza di codice, potresti salvare in una variabile "winner" il giocatore che vince utiizzando l'operatore ternario e poi scrivere una sola print al posto di scriverne due quasi uguali

src/ex6.py Outdated
Comment on lines 28 to 41
if giocatore1[0]>giocatore2[0]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

if giocatore1[1]>giocatore2[1]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

if giocatore1[2]>giocatore2[2]:
counterGiocatore1+=1
else:
counterGiocatore2+=1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

questo codice è un po' ridondante non credi?
forse creando una funzione potresti ridurre la ridondanza, oppure potresti scriverlo meglio con un ciclo for ed in 3 righe te ne esci ;-)


a = int(random()*10)
b = int(random()*10)
d = int(random()*10)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definisci una tua funzione random che esegua questa operazione random()*10

if giocatore1[2]>giocatore2[2]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aggiungi dei commenti per rendere più chiaro il codice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants