Skip to content

Commit 2fb0b77

Browse files
committed
updated
1 parent b0d7595 commit 2fb0b77

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

ex036.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa. Pergunte o valor da casa, o salário
2-
# do comprador e em quantos anos ele vai pagar. A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado.
3-
casa = float(input('Qual o valor da casa que você deseja comprar em R$:'))
4-
salario = float(input('Qual o seu salário em R$:'))
5-
tempo = float(input('Em quantos anos você quer pagar a casa?'))
6-
prestacao = casa / (tempo * 12)
7-
condicao = salario * 0.30
8-
print('Para pagar uma casa de R${} em {} anos.'.format(casa, tempo), end='')
9-
print('A prestação será de R${}.'.format(prestacao))
10-
if prestacao <= condicao:
11-
print('Parabéns foi aprovado o emprestimo!')
1+
#Write a program to approve a bank loan for the purchase of a house. Ask the buyer for the value of the house, the
2+
# buyer's salary and in how many years he will pay it off. The monthly payment cannot exceed 30% of the salary or
3+
# else the loan will be denied.
4+
house = float(input('What is the value of the house you want to buy in R$:'))
5+
salary = float(input('What is your salary in R$?:'))
6+
time = float(input('How many years do you want to pay off the house?'))
7+
installment = house / (time * 12)
8+
condition = salary * 0.30
9+
print(f'To pay for a house R${house} in {time} years.')
10+
print(f'The installment will be of R${installment}.')
11+
if installment <= condition:
12+
print('Congratulations your loan was approved!')
1213
else:
13-
print('Tente adicionar mais uma renda')
14+
print('Try adding one more income.')

ex037.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# : Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário escolher qual será a base
2-
# de conversão: 1 para binário, 2 para octal e 3 para hexadecimal.
3-
numero = int(input('Digite um número inteiro:'))
4-
print('''Escolha uma das bases para conversão:
5-
[ 1 ] converter para BINÁRIO
6-
[ 2 ] converter para OCTAL
7-
[ 3 ] converter para HEXADECIMAL''')
8-
opcao= int(input('Sua opção:'))
9-
if opcao == 1:
10-
print('{} convertido para BINÁRIO é igual a {}.'.format(numero, bin(numero)[2:]))
11-
elif opcao == 2:
12-
print('{} convertido para OCTAL é igual a {}.'.format(numero, oct(numero)[2:]))
13-
elif opcao == 3:
14-
print('{} convertido para HEXADECIMAL fica {}.'.format(numero, hex(numero)[2:]))
1+
#Write a Python program that reads any integer and asks the user to choose the conversion base: 1 for binary, 2 for
2+
# octal, and 3 for hexadecimal
3+
number= int(input('Enter an integer:'))
4+
print('''Choose one of the bases for conversion:
5+
[ 1 ] convert to BINARY
6+
[ 2 ] convert to OCTAL
7+
[ 3 ] convert toHEXADECIMAL''')
8+
option = int(input('your choose:'))
9+
if option == 1:
10+
print(f'{number} converted to binary it becomes {bin(number)[2:]}.')
11+
elif option == 2:
12+
print(f'{number} converted to octal it becomes {oct(number)[2:]}.')
13+
elif option == 3:
14+
print(f'{number} converted to hexadecimal it becomes {hex(number)[2:]}.')
1515
else:
16-
print('Opção inválida tente novamente!')
16+
print('Invalid option try again!')

ex038.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Escreva um programa que leia dois números inteiros e compare-os. mostrando na tela uma mensagem:
2-
# – O primeiro valor é maior
3-
# – O segundo valor é maior
4-
# – Não existe valor maior, os dois são iguais
5-
n1 = int(input('Digite um número inteiro:'))
6-
n2 = int(input('Digite outro número inteiro:'))
7-
if n1 > n2:
8-
print('O número {} é maior que o {}.'.format(n1, n2))
1+
# Write a program that reads two integers and compares them, displaying a message on the screen:
2+
# – The first value is greater
3+
# – The second value is greater
4+
# – There is no greater value, both are equal
5+
first_number = int(input('Enter an integer:'))
6+
second_number = int(input('Enter other integer:'))
7+
if first_number > second_number:
8+
print(f'The number {first_number} is greater than {second_number}.')
99
elif n1 < n2:
1010
print('O número {} é maior que o {}.'.format(n2, n1))
1111
else:

0 commit comments

Comments
 (0)