How to repeat a code at the end?

Asked

Viewed 10 times

0

Hello, I’d like to know how to make this code repeat at the end, I know it may seem simple but I haven’t found anywhere the answer

var = int(input('Insert: 1 for +; 2 for -; 3 for X; 4 for /; 5 for ; 6 for root '))

if var == 1 :

x=int(input('Primeiro valor : '))
y=int(input('Segundo valor : '))
res =  x+y
print(x, ' + ', y, ' = ', res)

Elif var == 2 :

q=int(input('Primeiro valor : '))
w=int(input('Segundo valor : '))
res = q-w
print(q, ' + ', w, ' = ', res)

Elif var == 3 :

a=int(input('Primeiro valor : '))
s=int(input('Segundo valor : '))
res = a*s
print(a, ' X ', s, ' = ', res)

Elif var == 4 :

e=int(input('Numerador : '))
r=int(input('Denominador : '))
res = e/r
print(e, ' / ', r, ' = ', res)

Elif var == 5 :

d=int(input('Base : '))
f=int(input('Expoente : '))
res = d**f
print(d, ' ^ ', f, ' = ', res)

Elif var == 6 :

g=int(input('Radicando :'))
h=int(input('Índice : '))
res = g**(1/h)
print('√ ', g, ' = ', res)
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.