Skip to content

Commit 2baff48

Browse files
committed
updated
1 parent 6b823c8 commit 2baff48

File tree

4 files changed

+46
-44
lines changed

4 files changed

+46
-44
lines changed

ex042.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Refaça o DESAFIO 35 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado:
2-
# – EQUILÁTERO: todos os lados iguais
3-
# – ISÓSCELES: dois lados iguais, um diferente
4-
# – ESCALENO: todos os lados diferentes
5-
r1 = float(input('Primeiro segmento:'))
6-
r2 = float(input('Segundo segmento:'))
7-
r3 = float(input('Terceiro seguimento:'))
8-
if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2:
9-
print('Os seguimentos acima podem formar um triângulo!', end=' ')
10-
if r1 == r2 == r3:
11-
print('Equilatero!')
12-
elif r1 != r2 != r3 != r1:
13-
print('Escaleno.')
1+
# Redo triangle challenge 35, adding the feature of showing what type of triangle will be formed:
2+
# – EQUILATERAL: all sides equal
3+
# – ISOSCELES: two sides equal, one different
4+
# – SCALENE: all sides different
5+
first_segment = float(input('Enter thr first segment:'))
6+
second_segment = float(input('Enter the second segment:'))
7+
tirdh_segment = float(input('Enter the tirdh segment:'))
8+
if first_segment < second_segment + tirdh_segment and second_segment < first_segment + tirdh_segment and tirdh_segment < first_segment + second_segment:
9+
print('The segments above CAN form a triangle!', end=' ')
10+
if first_segment == second_segment == tirdh_segment:
11+
print('Equilateral!')
12+
elif first_segment != second_segment != tirdh_segment != first_segment:
13+
print('Scalene!')
1414
else:
15-
print('Isósceles.')
15+
print('Isosceles.')
1616
else:
17-
print('Os seguimentos não podem formar um triângulo.')
17+
print('The segments above CAN NOT form a triangle!.')

ex043.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu Índice de Massa Corporal (IMC) e
2-
# mostre seu status, de acordo com a tabela abaixo:
3-
# – IMC abaixo de 18,5: Abaixo do Peso
4-
#– Entre 18,5 e 25: Peso Ideal
5-
#– 25 até 30: Sobrepeso
6-
#– 30 até 40: Obesidade
7-
#– Acima de 40: Obesidade Mórbida
8-
peso = float(input("Digite o seu peso em Kg:"))
9-
altura = float(input('Digite a sua altura em metros:'))
10-
imc = peso / (altura ** 2)
11-
print('Seu peso é de {}kg e sua altura é de {}m, logo seu IMC é de {:.2f}.'.format(peso, altura, imc))
12-
if imc < 18.5:
13-
print('Você está abaixo do peso.')
14-
elif 18.5 <= imc < 25:
15-
print('Você está no seu peso ideal!')
16-
elif 25 <= imc < 30:
17-
print('Você está com sobrepeso.')
1+
#Develop a logic that reads a person's weight and height, calculates their Body Mass Index (BMI) and
2+
# shows their status, according to the table below:
3+
# – BMI below 18.5: Underweight
4+
#– Between 18.5 and 25: Ideal Weight
5+
#– 25 to 30: Overweight
6+
#– 30 to 40: Obesity
7+
#– Over 40: Morbidly Obese
8+
weight = float(input("Enter your weight in Kg:"))
9+
height = float(input('Enter your height in meters:'))
10+
bmi = weight / (height ** 2)
11+
print(f'Your weight is {weight}kg and your height is {height}m, your BMI is {bmi:.2f}.')
12+
if bmi < 18.5:
13+
print('You are underweight.')
14+
elif 18.5 <= bmi < 25:
15+
print('You are ideal weight!')
16+
elif 25 <= bmi < 30:
17+
print('You are overweight.')
1818
elif 30 <= 40:
19-
print('Você está obeso.')
20-
elif imc >= 40:
21-
print('Você esta com obesidade mórbida.')
19+
print('You are obesity.')
20+
elif bmi >= 40:
21+
print('You are morbidly obese.')

ex050.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#Desenvolva um programa que leia seis números inteiros e mostre a soma apenas daqueles que forem pares. Se o valor
2-
# digitado for ímpar, desconsidere-o.
3-
soma = 0
4-
cont = 0
1+
#Develop a program that reads six integers and displays the sum of only those that are even. If the value
2+
# entered is odd, disregard it.
3+
sum_numbers = 0
4+
counter = 0
55
for c in range (1, 7):
6-
num = int(input('Digite o {} valor:'.format(c)))
7-
if num % 2 == 0:
8-
soma += num
9-
cont += 1
10-
print("Você informou {} números pares a soma foi {}.".format(cont, soma))
6+
numbers = int(input(f'Enter a {c} value:'))
7+
if sum_numbers % 2 == 0:
8+
sum_numbers += numbers
9+
counter += 1
10+
print(f"You informed {counter} neven numbers the sum was {sum_numbers}.")

ex062.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Improve challenge 61 by asking the user if he wants to show some more terms. The program will exit when he says he
2+
# wants to show 0 terms.

0 commit comments

Comments
 (0)