-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Magda Rocha
committed
Oct 16, 2023
1 parent
01205b0
commit 52a815d
Showing
23 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rec.m4a |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Criar um script que leia o nome de uma pessoa e mostre uma mensagem de boas vindas, com o nome da pessoa | ||
|
||
nome = input('Como te chamas?') | ||
boasvindas = 'Bem vindo ao Python!' | ||
|
||
print(boasvindas, nome) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ler quanto dinheiro a pessoa tem na carteira em reais e mostrar quantos dolares pode comprar | ||
|
||
reais = float(input('Quanto dinheiro tens em reais?')) | ||
dolares = reais / 3.27 | ||
print('Tu tens {:.3f} dólares'.format(dolares)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Ler a largura e a altura de uma paredes em metros, calcule a sua área e a quantidade de tinta necessária para pintá-la, sabendo que cada litro de tinta pinta 2m2 | ||
|
||
largura = float(input('Qual é a largura?')) | ||
altura = float(input('Qual é a altura?')) | ||
area = largura * altura | ||
tinta = area / 2 | ||
print('A área da parede é {} e são necessários {} litros de tinta para a pintar'.format( area , tinta)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ler o preço de um produto e mostrar o seu novo preço com 5% de desconto | ||
|
||
preco = float(input(' Qual é o preço do produto?')) | ||
desconto = preco * 0.95 | ||
print('O preço do produto é {} e com desconto de 5pc fica a {}'.format( preco , desconto)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ler o salário de um funcionário e mostrar o novo salário com 15% de aumento | ||
|
||
salario = float(input(' Qual é o teu salário?')) | ||
novosalario = salario * (1+0.15) | ||
print('O salário com aumento é: {}'.format(novosalario)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ler um numero real qualquer pelo teclado e mostrar a sua porçao inteira | ||
import math | ||
numero = float(input('Escreve um número ')) | ||
inteira = math.trunc(numero) | ||
print('A parte inteira do número é {}'.format(inteira)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Ler o comprimento do cateto adjacente de um triângulo retângulo e calcular o mostrar o comprimento da hipotenusa | ||
|
||
import math | ||
catetooposto = float(input('Qual o comprimento do cateto oposto?')) | ||
catetoadjacente = float(input('Qual é o comprimento do cateto adjacente?')) | ||
hipotenusa = math.hypot(catetooposto , catetoadjacente) | ||
print('O comprimento da hipotenusa é: {}'.format(math.trunc(hipotenusa))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#Ler um ângulo qualquer e mostrar o valor do seno, cosseno e tangente desse ângulo | ||
|
||
import math | ||
angulo = float(input('Qual o ângulo?')) | ||
angulo = math.radians(angulo) | ||
seno = math.sin(angulo) | ||
cosseno = math.cos(angulo) | ||
tangente = math.tan(angulo) | ||
|
||
print('O valor do seno é {} , o valor do cosseno é {:.3f} e o valor da tangente é {}'.format(seno , cosseno , tangente)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Um professor quer sortear um dos 4 alunos para apagar o quadro. Fazer um programa que ajude, a escolher um nome aleatoriamente | ||
|
||
import random | ||
nome1 = input('Escreve um nome') | ||
nome2 = input('Escreve outro nome') | ||
nome3 = input('Escreve mais um nome') | ||
nome4 = input('Escreve o último nome') | ||
lista = [nome1 , nome2 , nome3 , nome4] | ||
|
||
print(random.choice(lista)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Criar um script que leia o dia, o mês e o ano de nascimento de uma pessoa e mostre uma mensagem com esses valores | ||
|
||
dia = input('dia ') | ||
mes = input('mes ') | ||
ano = input('ano ') | ||
print('Nasceste no dia' , dia , 'do' , mes , 'de' , ano , ', Certo?') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#O professor quer sortear a ordem de apresentação dos trabalhos dos alunos. Fazer um programa que leia o nome dos quatro alunos e mostre a ordem sorteada. | ||
|
||
import random | ||
nome1 = input('Escreva nome ') | ||
nome2 = input('Escreva outro nome ') | ||
nome3 = input('Escreva outro ') | ||
nome4 = input('Escreva o último ') | ||
|
||
lista = [nome1, nome2, nome3, nome4] | ||
random.shuffle(lista) | ||
|
||
print(lista) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Fazer programa que abra um ficheiro mp3 | ||
|
||
import os | ||
|
||
os.startfile('C:\\Users\\mrocha\\Desktop\\Quality assurance\\Python\\Prática\\rec.m4a') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#Criar um script que leia dois números e tente mostrar a soma entre eles | ||
|
||
|
||
numero = int(input("primeiro numero")) | ||
numero2 = int(input("segundo numero")) | ||
numero3 = numero + numero2 | ||
print('A soma entre {} e {} é {}'.format(numero , numero2 , numero3)) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ler algo e mostrar o tipo primitivo da variável criada e as informações sobre ela | ||
|
||
teste = input('Escreve algo:') | ||
print(type(teste)) | ||
print(teste.isnumeric()) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Programa que leia um número inteiro e mostre no ecrã o seu sucessor e o antecessor | ||
|
||
numero = int(input('Escreve um número: ')) | ||
antecessor = numero - 1 | ||
sucessor = numero + 1 | ||
print('O número anterior é: {} e o número posterior é: {}'.format(antecessor , sucessor)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Algoritmo que leia um número e mostre o seu dobro, triplo e raíz quadrada | ||
|
||
numero = int(input('Escreve um número')) | ||
dobro = numero * 2 | ||
triplo = numero * 3 | ||
raizquadrada = numero **(1/2) | ||
print('O dobro é: {}, o triplo é {} e a raiz quadrada é {:.3f}'.format(dobro, triplo, raizquadrada)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Ler as duas notas de um aluno e calcular e mostrar a média | ||
|
||
nota1 = int(input('Qual foi a primeira nota?')) | ||
nota2 = int(input('Qual foi a segunda nota?')) | ||
media = (nota1 + nota2) / 2 | ||
print('A média das duas notas é: {}'.format(media)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ler um valor em metro e mostrar o resultado em centimetros e milimetros | ||
valor = float(input('Qual é o valor em metros? ')) | ||
centimetros = int(valor * 100) | ||
milimetros = int(valor * 1000) | ||
print('O valor em centimetros é: {} e o valor em milimetros é: {}'.format( centimetros , milimetros)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#Ler um número inteiro e mostrar a sua tabuada | ||
|
||
numero = int(input('Escreve um número: ')) | ||
x1 = numero * 1 | ||
x2 = numero * 2 | ||
x3 = numero * 3 | ||
x4 = numero * 4 | ||
x5 = numero * 5 | ||
x6 = numero * 6 | ||
x7 = numero * 7 | ||
x8 = numero * 8 | ||
x9 = numero * 9 | ||
x10 = numero * 10 | ||
print('A tabuada deste número é {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}'.format(x1 , x2, x3, x4, x5, x6, x7, x8, x9, x10)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Print Welcome Message | ||
print('Hello World') | ||
|
||
message = """Bobby's World | ||
ola""" | ||
|
||
print(message) | ||
|
||
print(len(message)) | ||
|
||
message = "Magda Rocha" | ||
print(message[:5]) | ||
|
||
print(message.lower()) | ||
print(message.upper()) | ||
message = "Magda Rocha Magda Rocha" | ||
print(message.count("a")) | ||
|
||
print(message.replace("Magda" , "Maria")) | ||
new_message = (message.replace("Magda" , "Maria")) | ||
print(new_message.find("Maria")) | ||
greeting = "Hello" | ||
name = "Magda" | ||
message = greeting + " " + name | ||
print(message) | ||
message = "{}, {}".format(greeting, name) | ||
print(message) | ||
n = message.upper() | ||
print(n) | ||
soma = 65 + 57 | ||
print(soma) | ||
nome = 'Magda' | ||
idade = 20 | ||
peso = 50.5 | ||
print(nome, idade, peso) | ||
nome = input('Como te chamas?') | ||
idade = input('Qual a tua idade?') | ||
peso = input('Quanto pesas?') | ||
print(nome, idade, peso) | ||
nome = 'Magda' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
nome = input("Como te chamas?") | ||
variavel = "Bem vinda ao mundo!" | ||
print(variavel , nome) | ||
|
||
dia = input("Dia de nascimento") | ||
mes = input("mês de nascimento") | ||
ano = input("ano de nascimento") | ||
print("Tu nasceste no dia" , dia , "de" , mes , "de" , ano) | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import emoji | ||
print(emoji.emojize('Olá, mundo :sunglasses:')) |