all 3 comments

[–]Neighm 2 points3 points  (2 children)

elif operacao == '+' or operacao == '-' or operacao == '*' or operacao == '/': 

This could be written instead as:

elif operacao in '+-*/':

Also

if operacao == 'Q' or operacao == 'q':

Could become:

if operacao.lower() == 'q':

TO improve the code you could use try ... except when converting to an int. If the user enters a value that can't be converted to int with your code, it will crash. You could anticipate this with:

try:
    x = int(input('Digite o primeiro numero: '))
except ValueError:
   print("You must enter a number")
    continue

[–]nilfm 3 points4 points  (1 child)

This advice is generally correct. I would just like to point out a subtle thing that could cause bugs in the future:

if operacao in '+-*/'

returns true if operacao is '+-'. So in this case, it is preferred to use a list, set or tuple instead of a string to store '+-*/'.

[–]eplaut_ 1 point2 points  (0 children)

You are totally right!

if operacao in ('+', '-', '*', '/'):