Last active
August 10, 2020 14:13
-
-
Save Gabriel-bits/78981ca51a7adeca918e718c04f08a5b to your computer and use it in GitHub Desktop.
Calculadora teste
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
# variaveis bool | |
loop = True | |
conta = True | |
# Funções da Calculadora | |
def escolher(): | |
print(' [ 1 ] Quer uma conta contínua') | |
print(' [ 2 ] Uma conta só') | |
def opç(): | |
print(" [ 1 ] Multiplicação") | |
print(" [ 2 ] Divisão") | |
print(" [ 3 ] Adição") | |
print(" [ 4 ] Subtração") | |
print(" [ 5 ] Tabela") | |
print(" [ 6 ] Sair") | |
def tab(): | |
global n1 | |
for c in range(100): | |
r1 = n1 + n2 | |
print(r1) | |
n1 = r1 | |
time.sleep(0.1) | |
if n1 >= 100: | |
break | |
def multiplicar(): | |
r1 = n1 * n2 | |
print(r1) | |
def dividir(): | |
r1 = n1 // n2 | |
print(r1) | |
def adicionar(): | |
r1 = n1 + n2 | |
print(r1) | |
def subtrair(): | |
r1 = n1 - n2 | |
print(r1) | |
def pular(): | |
print(' '*100) | |
def lin(): | |
print('='*30) | |
def fim(): | |
lin() | |
print('FIM') | |
lin() | |
# Interação base | |
escolher() | |
pergun = int(input('digite...')) | |
# Ações and Loop | |
if pergun == 1: | |
while loop: | |
lin() | |
opç() | |
lin() | |
op = int(input("digite... ")) | |
lin() | |
if op == 1: | |
print('[Multiplicação]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Multiplo... ')) | |
multiplicar() | |
lin() | |
elif op == 2: | |
print('[Divisão]') | |
n1 = int(input('Dividendo... ')) | |
n2 = int(input('Divisor... ')) | |
dividir() | |
elif op == 3: | |
print('[Adição]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Adição... ')) | |
adicionar() | |
elif op == 4: | |
print('[Subtração]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Subtrair... ')) | |
subtrair() | |
elif op == 5: | |
print('[Tabela]') | |
n1 = int(input('Qual tabela... ')) | |
n2 = int(input('Qual numero começa... ')) | |
tab() | |
pular() | |
elif op == 6: | |
lin() | |
print('[Sair]') | |
lin() | |
loop = False | |
else: | |
lin() | |
print("Desconheso o estilo da conta ! ") | |
loop = False | |
lin() | |
elif pergun == 2: | |
lin() | |
opç() | |
lin() | |
op = int(input("digite... ")) | |
lin() | |
if op == 1: | |
print('[Multiplicação]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Multiplo... ')) | |
multiplicar() | |
lin() | |
elif op == 2: | |
print('[Divisão]') | |
n1 = int(input('Dividendo... ')) | |
n2 = int(input('Divisor... ')) | |
dividir() | |
elif op == 3: | |
print('[Adição]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Adição... ')) | |
adicionar() | |
elif op == 4: | |
print('[Subtração]') | |
n1 = int(input('Numero... ')) | |
n2 = int(input('Subtrair... ')) | |
subtrair() | |
elif op == 5: | |
print('[Tabela]') | |
n1 = int(input('Qual tabela... ')) | |
n2 = int(input('Qual numero começa... ')) | |
tab() | |
pular() | |
elif op == 6: | |
lin() | |
print('[Sair]') | |
lin() | |
loop = False | |
else: | |
lin() | |
print("Desconheso o estilo da conta ! ") | |
loop = False | |
lin() | |
fim() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def lin(tit, txt): | |
print('-'*30) | |
print(tit) | |
print('-'*30) | |
print(txt) | |
print('='*30) | |
n1 = int(input('Qual tabela... ')) | |
n2 = int(input('Qual numero começa... ')) | |
for i in range(100): | |
r1 = n1 + n2 | |
print(r1) | |
n1 = r1 | |
time.sleep(0.1) | |
if n1 >= 100: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment