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

Created a new file named randomNumber.py #113

Closed
wants to merge 11 commits into from
Closed

Created a new file named randomNumber.py #113

wants to merge 11 commits into from

Conversation

SamuExe14
Copy link

No description provided.

print("\nThe sum is:",int(x) + int(y))
print("The difference is:", int(x)- int(y))
print("The multiplication is: ", int(x) * int(y))
print("The division is: ", float(x)/float(y))

Choose a reason for hiding this comment

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

Aggiungi un blocco try/except per gestire le eccezioni che potrebbero essere scatenate da questo operatore.

print("\nThe sum is:",int(x) + int(y))
print("The difference is:", int(x)- int(y))
print("The multiplication is: ", int(x) * int(y))
print("The division is: ", float(x)/float(y))

Choose a reason for hiding this comment

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

Stai eseguendo il casting a int/float molteplici volte, fallo una volta sola in fase di definizione.

@@ -0,0 +1,3 @@
import random

Choose a reason for hiding this comment

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

Importa solo la funzione randint dal modulo random.

@@ -0,0 +1,3 @@
import random

print("Your random number is:", random.randint(1,100))

Choose a reason for hiding this comment

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

Definisci sempre i valori costanti in opportune variabili.

MIN_NUMBER=1
MAX_NUMBER= 100

tests/verify.py Outdated

number = input("Enter a number to check if is present in the array:")

if int(number) in array:

Choose a reason for hiding this comment

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

Effettua il casting ad int in fase di definizione/assegnazione della variabile.

@SamuExe14 SamuExe14 closed this by deleting the head repository Dec 9, 2023
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