-
Notifications
You must be signed in to change notification settings - Fork 79
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: add calculator #149
base: main
Are you sure you want to change the base?
feat: add calculator #149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forse il cast può essere omesso perchè implicito. Vedi. Per il resto è ok
print("Sum: "+str(a+b)) | ||
print("Difference:"+str(a-b)) | ||
print("Product: "+str(a*b)) | ||
print("Division: "+str(a/b)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L;interpolazione delle stringhe in python puo' essere gestita eleganemente in vari modi:
# fstring (cast implicito)
print(f"Sum: {a + b}")
# concatenazione classica (necessita cast esplicito)
print("Sum: " + str(a + b))
# sfruttando i parametri di print (cast implicito)
print("Sum:", a + b)
print("Sum: "+str(a+b)) | ||
print("Difference:"+str(a-b)) | ||
print("Product: "+str(a*b)) | ||
print("Division: "+str(a/b)) |
There was a problem hiding this comment.
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.
No description provided.