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: add calculator #149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Henryskio
Copy link

No description provided.

Copy link
Collaborator

@makapx makapx left a 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

Comment on lines +3 to +6
print("Sum: "+str(a+b))
print("Difference:"+str(a-b))
print("Product: "+str(a*b))
print("Division: "+str(a/b))
Copy link
Collaborator

@TendTo TendTo Oct 30, 2023

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))

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.

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.

5 participants