SlideShare a Scribd company logo
1 of 11
Download to read offline
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 1/11
1
2
3
4
5
6
texto = 'texto'
texto_2 = 'texto2'
num = 10
num_2 = 5.7
flag = True
flag_2 = False
1

2

3

4

5

6

7

8

9

from IPython.core.display import clear_output

nota1 = float(input('Digite sua primeira nota'))

nota2 = float(input('Digite a sua segunda nota'))

clear_output(nota1)

clear_output(nota2)

print('nota 1 = ',nota1)

print('nota 2 = ',nota2)

media = ((nota1+nota2)/2)

print('média = ',media)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

#OPERADORES RELACIONAIS



nota1 = float(input('Digite sua primeira nota'))

nota2 = float(input('Digite a sua segunda nota'))

clear_output(nota1)

clear_output(nota2)

print('Nota 1 = ',nota1)

print('Nota 2 = ',nota2)

comparacao1 = nota1 == nota2

print('Nota 1 é igual a nota 2?:',comparacao1)

comparacao2 = nota1 != nota2

print('Nota 1 é diferente da nota 2?:',comparacao2)

comparacao3 = nota1 > nota2

print('Nota 1 é maior que a nota 2?:',comparacao3)

comparacao4 = nota1 >= nota2

print('Nota 1 é maior ou igual a nota 2?:',comparacao4)

comparacao5 = nota1 < nota2

print('Nota 1 é menor que a nota 2?:',comparacao5)

comparacao6 = nota1 <= nota2

print('Nota 1 é menor ou igual a nota 2?:',comparacao6)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com soma

saldo = 2000.00

deposito = 500.00

saldo += deposito

print('O valor atual do saldo é:',saldo)

1

2

3

4

5
#Atribuição simples



#1 Atribuição com subtração

saldo = 2000.00

500 00
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 2/11
5

6

7

saue = 500.00

saldo -= deposito

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com multiplicação

saldo = 2000.00

juros = 2

saldo *= juros

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com divisão
saldo = 2000.00

juros = 2

saldo /= juros

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com divisão com resultado inteiro

saldo = 2000.00

juros = 3

saldo //= juros

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com divisão com resto

saldo = 200
juros = 3

saldo %= juros

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

7

#Atribuição simples



#1 Atribuição com exponenciação

saldo = 3

juros = 2

saldo **= juros

print('O valor atual do saldo é:',saldo)

1

2

3

4

5

6

# Operadores lógicos ou booleanos



# Negação

#!(expressão verdadeira) - Resultado: Falso

#!(expressão falsa) - Resultado: Verdadeiro
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 3/11
1

2

3

4

5

6

7

8

9

10

11

12

# Operadores lógicos ou booleanos



# Conjunção (um e outro) operador (and)



# premissa 1    presmissa 2     resultado (1 e 2)

#     V             V               V

#     V             F               F

#     F             V               F

#     F             F               F

n1 = 10

n2 = 7

(n1 >= 7) and (n2 <3)

1

2

3

4

5

6

7

8

9

10

11

12

# Operadores lógicos ou booleanos



# disjunção (um ou outro) operador (or)



# premissa 1    presmissa 2     resultado (1 ou 2)

#     V             V               V

#     V             F               V

#     F             V               V

#     F             F               F

n1 = 10

n2 = 7

(n1 >= 7) or (n2 <3)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

# Identação


# Comando IF -ELSE
'''

if expressão lógica for verdadeira:

  Aqui será o bloco executado se a condição for verdadeira

else:expressão lógica for falsa:

  Aqui será o bloco executado se a condição for falsa

''' 
'''

Exemplo 1 - Imprima na tela um valor inteiro lido, caso ele seja maior do 
que 10

'''



num = int(input('digite um número: '))

clear_output(num)

if num > 10:

  print(num)

1

2

3

4

5

6

7

8
'''

Exemplo2 - Faça um programa que leia um número inteiro e diga se o número é 

positivo negativo ou se é o número 0

'''

num = int(input('Digite um número: '))

clear_output(num)

if num > 0:

i t( 'É ú iti ')
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 4/11
8

9

10

11

12

  print(num,'É um número positivo')

elif num == 0:

  print(num,'é nulo')

else:

  print(num, 'É um número negativo')  

1

2

3

4

5

6

7

8

9

10

#Exemplo3 - Faça um programa que leia um número inteiro e some 5 caso seja par

#           ou some 8 caso seja ímpar. Ao final imprima na tela o resultado

num = int(input('Digite um número'))

resto = num % 2

clear_output(num)

print(f"O número digitado é {num}")

if resto == 0:

  print('O resultado da soma é',num+5)

else:

  print('O resultado da soma é',num+8)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

#Exemplo4 - IF E ELIF ELSE



'''

 CRIE UM PROGRAMA QUE LEIA UM NÙMERO INTEIRO E DIGA SE:

 ELE ESTÀ ENTRE 0 e 9

 ELE ESTÁ ENTRE 10 e 19

 ELE ESTÁ ENTRE 20 e 29

 ELE É MAIOR OU IGUAL 30

 ELE É NEGATIVO

'''

num = int(input('Digite um número'))

clear_output(num)

print(f"O número digitado é {num}")

if num >= 0 and num <= 9:

  print('Ele está entre 0 e 9')

elif num >= 10 and num <= 19:

  print('Ele está entre 10 e 19')

elif num >= 20 and num <= 29:

  print('Ele está entre 20 e 29')

elif num >= 30:

  print('Ele é maior ou igual a 30')      

else:

  print('Ele é negativo')

1

2

3

4

5

6

7

8

9

10

11

12
#Exemplo4 - IF E ELIF ELSE



'''

 CRIE UM PROGRAMA QUE LEIA UM NÙMERO INTEIRO E DIGA SE:

 ELE ESTÀ ENTRE 0 e 9

 ELE ESTÁ ENTRE 10 e 19

 ELE ESTÁ ENTRE 20 e 29

 ELE É MAIOR OU IGUAL 30

 ELE É NEGATIVO

'''

num = int(input('Digite um número'))

l t t( )
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 5/11
12

13

14

15

16

17

18

19

20

21

22

23

clear_output(num)

print(f"O número digitado é {num}")

if num < 0:

  print('Ele é negativo')

elif 0 <= num <= 9:

  print('Ele está entre 0 e 9')

elif 10 <= num <= 19:

  print('Ele está entre 10 e 19') 

elif 20 <= num <= 29:

  print('Ele está entre 20 e 29')

else:

  print('Ele é maior ou igual a 30')

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

#Escreva um algoritmo que leia três valores inteiros e diferentes

# e mostre-os em ordem decrescente.

num1 = int(input('Digite o primeiro número'))

clear_output(num1)

print(f"O primeiro número digitado é {num1}")

num2 = int(input('Digite o segundo número'))

clear_output(num2)

print(f"O segundo número digitado é {num2}")

num3 = int(input('Digite o terceiro número'))

clear_output(num3)

print(f"Os números digitados são: {num1},{num2},{num3}")

if num1 == num2 or num2 == num3 or num1 == num3:

  print("Execute o programa novamente, digitando 3 números diferentes")

elif num1 <= num2 <= num3:

  print(f"A ordem decrescente é: {num3},{num2},{num1}")

elif num2 <= num1 <= num3:

  print(f"A ordem decrescente é: {num3},{num1},{num2}")

elif num3 <= num1 <= num2:

  print(f"A ordem decrescente é: {num2},{num1},{num3}")

elif num1 <= num3 <= num2:

  print(f"A ordem decrescente é: {num2},{num3},{num1}")

elif num3 <= num2 <= num1:

  print(f"A ordem decrescente é: {num1},{num2},{num3}")

else:

  print(f"A ordem decrescente é: {num1},{num3},{num2}")           

1

2

3

4

5

6

7

8

9

10

11

12

13

'''

Escreva um algoritmo que leia um número inteiro de 3 dígitos e imprima o número

 ao contrário EX: Pessoa digitou 123 Deverá mostrar 321 519 Deverá mostrar 915

''' 
dig1 = int(input('Informe o primeiro dígito'))

clear_output(dig1)

dig2 = int(input('Informe o segundo dígito'))

clear_output(dig2)

dig3 = int(input('Informe o terceiro dígito'))

clear_output(dig3)

#a = int(f"{dig2}{dig1}{dig3}")

print(f"O número digitado é {dig1}{dig2}{dig3}")

print(f"O seu reverso é {dig3}{dig2}{dig1}")

1 '''Tendo como dados de entrada a altura e o sexo de uma pessoa construa um
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 6/11
1

2

3

4

5

6

7

8

9

10

11

12

13

Tendo como dados de entrada a altura e o sexo de uma pessoa, construa um 

algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:

 ● para homens: (72.7 * h) – 58

 ● para mulheres: (62.1 * h) – 44.7 

'''

altura = float(input("digite sua altura em metros"))

clear_output(altura)

sexo = int(input("digite 1 para masculino ou 2 para feminino"))

clear_output(sexo)

if sexo == 1:

  print("Seu peso ideal é:",(altura*72.7)-58)

else:

  print("Seu peso ideal é:",(altura*62.1)-44.7)  

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

'''

10) O IMC – Indice de Massa Corporal é um critério da Organização Mundial de 

Saúde para dar umaindicação sobre a condição de peso de uma pessoa adulta.



 A fórmula é IMC = peso / ( altura )² 



Elabore um algoritmo que leia o peso e a altura de um adulto e mostre sua 
condição de acordo com a tabela abaixo. 

IMC em adultos      Condição

 Abaixo de 18,5 - Abaixo do peso

 Entre 18,5 e 25 - Peso normal 

Entre 25 e 30 - Acima do peso 

Acima de 30 obeso 


'''

altura = float(input("digite sua altura em metros"))

clear_output(altura)

peso = float(input("digite seu peso em kg"))

clear_output(peso)

imc = peso/(altura)**2

print(f"O seu IMC é: {imc}")

if imc < 18.5:

  print('Abaixo do peso')

elif 18.5 <= imc < 25:

  print('Peso normal')

elif 25 <= imc <= 30:

  print('Acima do peso') 

else:

  print('Obeso')

1

2

3

4

5

6

7

8

9

10
#Manipulando Strings

from IPython.core.display import clear_output

texto = "Renato meu bro"



print(texto[-5:-1])



minisculo = texto.lower()
print(minisculo)



i l t t ()
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 7/11
10

11

maiusculo = texto.upper()
print(maiusculo)

1

2

3

4

5

6

7

n = 1



while n < 10:

  print(n)

  if(n == 5):

    break

  n +=1  

1

2

3

4

5

6

7

8

9

10

11

12

13

n = 1

n2 = 2



soma = 0

from IPython.core.display import clear_output

while True:

  a = int(input("Digite um valor inteiro: "))

  clear_output(a)

  if 0 < a < 10:

    soma += a

  else:

    break

print(f'A soma dos números digitados foi: {soma}')        

1

2

3

4

5

6

7

8

total=0



for count in range(7):

    count += 1

    if(count % 3 == 0 ): continue

    total += count
    
print(total)

1

2

3

4

5

6

7

8

from IPython.core.display import clear_output

a = int(input("Digite um valor inteiro entre 10 e 50: "))

clear_output(a)

while a < 10 or a > 50:

  a = int(input("Digite um valor inteiro entre 10 e 50: "))

  clear_output(a)

 

print(f'O número digitado foi: {a}')

1

2

3

4

5

6

7

a = int(input("Digite um valor inteiro entre 100 e 999: "))

clear_output(a)

while (a < 100 or a > 999) and (a < -999 or a > -100):

  a = int(input("Digite um valor inteiro entre 100 e 999: "))

  clear_output(a)

 

print(f'O número digitado foi: {a}')

1 #1) Escrever um programa para exibir os números de 25 a 85 na tela
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 8/11
1

2

3

4

5

6

#1) Escrever um programa para exibir os números de 25 a 85 na tela.

n = 25



while n <= 85:

  print(n)

  n +=1  

1

2

3

4

5

6

7

8

#2) Escrever um programa para exibir os números de 1 a 100 em ordem inversa.

n = 100



while n > 0:

  print(n)

  if(n == 1):

    break

  n -=1  

1

2

3

4

5

6

7

8

#3)Fazer um programa para encontrar todos os números pares entre 1 e 100.

n = 2



while (n < 101) and (n % 2 == 0):

  print(n)

  if(n == 100):

    break

  n +=2  

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

'''

4)Ler 10 números e informar na tela quantos números pares foram digitados e 

quantos números ímpares foram digitados.

'''

somapar = 0 

somaimpar = 0

contador = 1



while (contador < 11):

  n = int(input(f"Digite o {contador} número: "))

  if n % 2 == 0:

    somapar +=1

  else:

    somaimpar +=1

  contador +=1

print(f"A quantidade de números pares foi: {somapar}")

print(f"A quantidade de números ímpares foi: {somaimpar}")

1

2

3

4

5

6

7

8

9

10
from numpy.core.fromnumeric import sort

from numpy.core.numerictypes import maximum_sctype

'''

4)Ler 10 números e informar na tela quantos números 

pares foram digitados e quantos números ímpares foram digitados.

'''

n1 = int(input("Digite um valor inteiro: "))

clear_output(n1)

n2 = int(input("Digite um valor inteiro: "))

l t t( 2)
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 9/11
10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

clear_output(n2)

n3 = int(input("Digite um valor inteiro: "))

clear_output(n3)

n4 = int(input("Digite um valor inteiro: "))

clear_output(n4)

n5 = int(input("Digite um valor inteiro: "))

clear_output(n5)

n6 = int(input("Digite um valor inteiro: "))

clear_output(n6)

n7 = int(input("Digite um valor inteiro: "))

clear_output(n7)

n8 = int(input("Digite um valor inteiro: "))

clear_output(n8)

n9 = int(input("Digite um valor inteiro: "))

clear_output(9)

n10 = int(input("Digite um valor inteiro: "))

clear_output(n10)

print(f"Os números digitados são: {n1},{n2},{n3},{n4},{n5},{n6},{n7},{n8},"

      +f"{n9},{n10}")

a = (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10)

print("O maior número digitado é: ",(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10))

even_count, odd_count = 0, 0

for num in a: 

      

    
    if num % 2 == 0: 

        even_count += 1

  

    else: 

        odd_count += 1

          

print("O número de pares na lista é: ", even_count) 

print("O número de ím1pares na lista é: ", odd_count)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21
#5)Crie um algoritmo que leia 10 números e informe o maior número lido

from numpy.core.numerictypes import maximum_sctype

n1 = int(input("Digite um valor inteiro: "))

clear_output(n1)

n2 = int(input("Digite um valor inteiro: "))

clear_output(n2)

n3 = int(input("Digite um valor inteiro: "))

clear_output(n3)

n4 = int(input("Digite um valor inteiro: "))

clear_output(n4)

n5 = int(input("Digite um valor inteiro: "))

clear_output(n5)

n6 = int(input("Digite um valor inteiro: "))

clear_output(n6)

n7 = int(input("Digite um valor inteiro: "))

clear_output(n7)

n8 = int(input("Digite um valor inteiro: "))

clear_output(n8)

n9 = int(input("Digite um valor inteiro: "))

clear_output(9)

10 i t(i t("Di it l i t i "))
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 10/11
21

22

23

24

25

n10 = int(input("Digite um valor inteiro: "))

clear_output(n10)

print(f"Os números digitados são: {n1},{n2},{n3},{n4},{n5},{n6},{n7},{n8},{n9},
      +f"{n10},")

print("O maior número digitado é: ",max(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10))

1

2

3

4

5

6

7

8

9

10

11

12

#5)Crie um algoritmo que leia 10 números e informe o maior número lido

contador = 0

maior = 0



while contador < 10:

  num = int(input(f"Digite o {contador+1} número: "))

  if contador == 0:

    maior = num

  if num > maior:

    maior = num

  contador +=1

print(f"O maior número é : {maior}")

1

2

3

4

5

6

7

8

#1)Fazer um programa para encontrar todos os múltiplos de 3 de 1 a 50.

n = 3



while (n < 51) and (n % 3 == 0):

  print(n)

  if(n == 50):

    break

  n +=3  

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

'''

2) Ler um valor inteiro (aceitar somente valores entre 1 e 10) e escrever a 

tabuada de 1 a 10 do valor lido.

'''

from IPython.core.display import clear_output

n = int(input(f'Digite um número inteiro entre 1 e 10'))

clear_output(n)

while (n < 1 or n > 10):

  n = int(input("Digite um valor inteiro entre 1 e 10: "))

  clear_output(a)

 

print(f'{n} x 1 = {n*1}')

print(f'{n} x 2 = {n*2}')

print(f'{n} x 3 = {n*3}')

print(f'{n} x 4 = {n*4}')

print(f'{n} x 5 = {n*5}')

print(f'{n} x 6 = {n*6}')

print(f'{n} x 7 = {n*7}')

print(f'{n} x 8 = {n*8}')

print(f'{n} x 9 = {n*9}')

print(f'{n} x 10 = {n*10}')

1
2
#3)Faça um programa que leia 5 idades e mostre na tela a média das idades lidas
contador = 0
10/02/2022 09:01 Python_aula02.ipynb - Colaboratory
https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 11/11
check 4s conclusão: 08:24
2
3
4
5
6
7
8
9
10
11
12
contador = 0
soma = 0
while contador < 5:
  idade = int(input(f"Digite a {contador+1} idade: "))
  if (idade < 0 or idade > 160):
    idade = int(input("Digite um valor inteiro entre 0 e 160: "))
  soma += idade
  contador +=1
print(f"A idade média é:", {soma/contador})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'''
4) Faça um programa que leia 3 notas (de 0 a 10) e informe na tela a 
média das notas lidas.
'''
contador = 0
soma = 0
while contador < 3:
  nota = int(input(f"Digite a {contador+1} nota: "))
  if (nota < 0 or nota > 10):
    nota = int(input("Digite um valor inteiro entre 0 e 10: "))
  soma += nota
  contador +=1
print(f"A nota média é:", {soma/contador})

More Related Content

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Python aula02.ipynb colaboratory

  • 1. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 1/11 1 2 3 4 5 6 texto = 'texto' texto_2 = 'texto2' num = 10 num_2 = 5.7 flag = True flag_2 = False 1 2 3 4 5 6 7 8 9 from IPython.core.display import clear_output nota1 = float(input('Digite sua primeira nota')) nota2 = float(input('Digite a sua segunda nota')) clear_output(nota1) clear_output(nota2) print('nota 1 = ',nota1) print('nota 2 = ',nota2) media = ((nota1+nota2)/2) print('média = ',media) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #OPERADORES RELACIONAIS nota1 = float(input('Digite sua primeira nota')) nota2 = float(input('Digite a sua segunda nota')) clear_output(nota1) clear_output(nota2) print('Nota 1 = ',nota1) print('Nota 2 = ',nota2) comparacao1 = nota1 == nota2 print('Nota 1 é igual a nota 2?:',comparacao1) comparacao2 = nota1 != nota2 print('Nota 1 é diferente da nota 2?:',comparacao2) comparacao3 = nota1 > nota2 print('Nota 1 é maior que a nota 2?:',comparacao3) comparacao4 = nota1 >= nota2 print('Nota 1 é maior ou igual a nota 2?:',comparacao4) comparacao5 = nota1 < nota2 print('Nota 1 é menor que a nota 2?:',comparacao5) comparacao6 = nota1 <= nota2 print('Nota 1 é menor ou igual a nota 2?:',comparacao6) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com soma saldo = 2000.00 deposito = 500.00 saldo += deposito print('O valor atual do saldo é:',saldo) 1 2 3 4 5 #Atribuição simples #1 Atribuição com subtração saldo = 2000.00 500 00
  • 2. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 2/11 5 6 7 saue = 500.00 saldo -= deposito print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com multiplicação saldo = 2000.00 juros = 2 saldo *= juros print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com divisão saldo = 2000.00 juros = 2 saldo /= juros print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com divisão com resultado inteiro saldo = 2000.00 juros = 3 saldo //= juros print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com divisão com resto saldo = 200 juros = 3 saldo %= juros print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 7 #Atribuição simples #1 Atribuição com exponenciação saldo = 3 juros = 2 saldo **= juros print('O valor atual do saldo é:',saldo) 1 2 3 4 5 6 # Operadores lógicos ou booleanos # Negação #!(expressão verdadeira) - Resultado: Falso #!(expressão falsa) - Resultado: Verdadeiro
  • 3. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 3/11 1 2 3 4 5 6 7 8 9 10 11 12 # Operadores lógicos ou booleanos # Conjunção (um e outro) operador (and) # premissa 1    presmissa 2     resultado (1 e 2) #     V             V               V #     V             F               F #     F             V               F #     F             F               F n1 = 10 n2 = 7 (n1 >= 7) and (n2 <3) 1 2 3 4 5 6 7 8 9 10 11 12 # Operadores lógicos ou booleanos # disjunção (um ou outro) operador (or) # premissa 1    presmissa 2     resultado (1 ou 2) #     V             V               V #     V             F               V #     F             V               V #     F             F               F n1 = 10 n2 = 7 (n1 >= 7) or (n2 <3) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # Identação # Comando IF -ELSE ''' if expressão lógica for verdadeira:   Aqui será o bloco executado se a condição for verdadeira else:expressão lógica for falsa:   Aqui será o bloco executado se a condição for falsa '''  ''' Exemplo 1 - Imprima na tela um valor inteiro lido, caso ele seja maior do  que 10 ''' num = int(input('digite um número: ')) clear_output(num) if num > 10:   print(num) 1 2 3 4 5 6 7 8 ''' Exemplo2 - Faça um programa que leia um número inteiro e diga se o número é  positivo negativo ou se é o número 0 ''' num = int(input('Digite um número: ')) clear_output(num) if num > 0: i t( 'É ú iti ')
  • 4. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 4/11 8 9 10 11 12   print(num,'É um número positivo') elif num == 0:   print(num,'é nulo') else:   print(num, 'É um número negativo')   1 2 3 4 5 6 7 8 9 10 #Exemplo3 - Faça um programa que leia um número inteiro e some 5 caso seja par #           ou some 8 caso seja ímpar. Ao final imprima na tela o resultado num = int(input('Digite um número')) resto = num % 2 clear_output(num) print(f"O número digitado é {num}") if resto == 0:   print('O resultado da soma é',num+5) else:   print('O resultado da soma é',num+8) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #Exemplo4 - IF E ELIF ELSE '''  CRIE UM PROGRAMA QUE LEIA UM NÙMERO INTEIRO E DIGA SE:  ELE ESTÀ ENTRE 0 e 9  ELE ESTÁ ENTRE 10 e 19  ELE ESTÁ ENTRE 20 e 29  ELE É MAIOR OU IGUAL 30  ELE É NEGATIVO ''' num = int(input('Digite um número')) clear_output(num) print(f"O número digitado é {num}") if num >= 0 and num <= 9:   print('Ele está entre 0 e 9') elif num >= 10 and num <= 19:   print('Ele está entre 10 e 19') elif num >= 20 and num <= 29:   print('Ele está entre 20 e 29') elif num >= 30:   print('Ele é maior ou igual a 30')       else:   print('Ele é negativo') 1 2 3 4 5 6 7 8 9 10 11 12 #Exemplo4 - IF E ELIF ELSE '''  CRIE UM PROGRAMA QUE LEIA UM NÙMERO INTEIRO E DIGA SE:  ELE ESTÀ ENTRE 0 e 9  ELE ESTÁ ENTRE 10 e 19  ELE ESTÁ ENTRE 20 e 29  ELE É MAIOR OU IGUAL 30  ELE É NEGATIVO ''' num = int(input('Digite um número')) l t t( )
  • 5. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 5/11 12 13 14 15 16 17 18 19 20 21 22 23 clear_output(num) print(f"O número digitado é {num}") if num < 0:   print('Ele é negativo') elif 0 <= num <= 9:   print('Ele está entre 0 e 9') elif 10 <= num <= 19:   print('Ele está entre 10 e 19')  elif 20 <= num <= 29:   print('Ele está entre 20 e 29') else:   print('Ele é maior ou igual a 30') 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #Escreva um algoritmo que leia três valores inteiros e diferentes # e mostre-os em ordem decrescente. num1 = int(input('Digite o primeiro número')) clear_output(num1) print(f"O primeiro número digitado é {num1}") num2 = int(input('Digite o segundo número')) clear_output(num2) print(f"O segundo número digitado é {num2}") num3 = int(input('Digite o terceiro número')) clear_output(num3) print(f"Os números digitados são: {num1},{num2},{num3}") if num1 == num2 or num2 == num3 or num1 == num3:   print("Execute o programa novamente, digitando 3 números diferentes") elif num1 <= num2 <= num3:   print(f"A ordem decrescente é: {num3},{num2},{num1}") elif num2 <= num1 <= num3:   print(f"A ordem decrescente é: {num3},{num1},{num2}") elif num3 <= num1 <= num2:   print(f"A ordem decrescente é: {num2},{num1},{num3}") elif num1 <= num3 <= num2:   print(f"A ordem decrescente é: {num2},{num3},{num1}") elif num3 <= num2 <= num1:   print(f"A ordem decrescente é: {num1},{num2},{num3}") else:   print(f"A ordem decrescente é: {num1},{num3},{num2}")            1 2 3 4 5 6 7 8 9 10 11 12 13 ''' Escreva um algoritmo que leia um número inteiro de 3 dígitos e imprima o número  ao contrário EX: Pessoa digitou 123 Deverá mostrar 321 519 Deverá mostrar 915 '''  dig1 = int(input('Informe o primeiro dígito')) clear_output(dig1) dig2 = int(input('Informe o segundo dígito')) clear_output(dig2) dig3 = int(input('Informe o terceiro dígito')) clear_output(dig3) #a = int(f"{dig2}{dig1}{dig3}") print(f"O número digitado é {dig1}{dig2}{dig3}") print(f"O seu reverso é {dig3}{dig2}{dig1}") 1 '''Tendo como dados de entrada a altura e o sexo de uma pessoa construa um
  • 6. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 6/11 1 2 3 4 5 6 7 8 9 10 11 12 13 Tendo como dados de entrada a altura e o sexo de uma pessoa, construa um  algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:  ● para homens: (72.7 * h) – 58  ● para mulheres: (62.1 * h) – 44.7  ''' altura = float(input("digite sua altura em metros")) clear_output(altura) sexo = int(input("digite 1 para masculino ou 2 para feminino")) clear_output(sexo) if sexo == 1:   print("Seu peso ideal é:",(altura*72.7)-58) else:   print("Seu peso ideal é:",(altura*62.1)-44.7)   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ''' 10) O IMC – Indice de Massa Corporal é um critério da Organização Mundial de  Saúde para dar umaindicação sobre a condição de peso de uma pessoa adulta.  A fórmula é IMC = peso / ( altura )²  Elabore um algoritmo que leia o peso e a altura de um adulto e mostre sua  condição de acordo com a tabela abaixo.  IMC em adultos      Condição  Abaixo de 18,5 - Abaixo do peso  Entre 18,5 e 25 - Peso normal  Entre 25 e 30 - Acima do peso  Acima de 30 obeso  ''' altura = float(input("digite sua altura em metros")) clear_output(altura) peso = float(input("digite seu peso em kg")) clear_output(peso) imc = peso/(altura)**2 print(f"O seu IMC é: {imc}") if imc < 18.5:   print('Abaixo do peso') elif 18.5 <= imc < 25:   print('Peso normal') elif 25 <= imc <= 30:   print('Acima do peso')  else:   print('Obeso') 1 2 3 4 5 6 7 8 9 10 #Manipulando Strings from IPython.core.display import clear_output texto = "Renato meu bro" print(texto[-5:-1]) minisculo = texto.lower() print(minisculo) i l t t ()
  • 7. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 7/11 10 11 maiusculo = texto.upper() print(maiusculo) 1 2 3 4 5 6 7 n = 1 while n < 10:   print(n)   if(n == 5):     break   n +=1   1 2 3 4 5 6 7 8 9 10 11 12 13 n = 1 n2 = 2 soma = 0 from IPython.core.display import clear_output while True:   a = int(input("Digite um valor inteiro: "))   clear_output(a)   if 0 < a < 10:     soma += a   else:     break print(f'A soma dos números digitados foi: {soma}')         1 2 3 4 5 6 7 8 total=0 for count in range(7):     count += 1     if(count % 3 == 0 ): continue     total += count      print(total) 1 2 3 4 5 6 7 8 from IPython.core.display import clear_output a = int(input("Digite um valor inteiro entre 10 e 50: ")) clear_output(a) while a < 10 or a > 50:   a = int(input("Digite um valor inteiro entre 10 e 50: "))   clear_output(a)   print(f'O número digitado foi: {a}') 1 2 3 4 5 6 7 a = int(input("Digite um valor inteiro entre 100 e 999: ")) clear_output(a) while (a < 100 or a > 999) and (a < -999 or a > -100):   a = int(input("Digite um valor inteiro entre 100 e 999: "))   clear_output(a)   print(f'O número digitado foi: {a}') 1 #1) Escrever um programa para exibir os números de 25 a 85 na tela
  • 8. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 8/11 1 2 3 4 5 6 #1) Escrever um programa para exibir os números de 25 a 85 na tela. n = 25 while n <= 85:   print(n)   n +=1   1 2 3 4 5 6 7 8 #2) Escrever um programa para exibir os números de 1 a 100 em ordem inversa. n = 100 while n > 0:   print(n)   if(n == 1):     break   n -=1   1 2 3 4 5 6 7 8 #3)Fazer um programa para encontrar todos os números pares entre 1 e 100. n = 2 while (n < 101) and (n % 2 == 0):   print(n)   if(n == 100):     break   n +=2   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ''' 4)Ler 10 números e informar na tela quantos números pares foram digitados e  quantos números ímpares foram digitados. ''' somapar = 0  somaimpar = 0 contador = 1 while (contador < 11):   n = int(input(f"Digite o {contador} número: "))   if n % 2 == 0:     somapar +=1   else:     somaimpar +=1   contador +=1 print(f"A quantidade de números pares foi: {somapar}") print(f"A quantidade de números ímpares foi: {somaimpar}") 1 2 3 4 5 6 7 8 9 10 from numpy.core.fromnumeric import sort from numpy.core.numerictypes import maximum_sctype ''' 4)Ler 10 números e informar na tela quantos números  pares foram digitados e quantos números ímpares foram digitados. ''' n1 = int(input("Digite um valor inteiro: ")) clear_output(n1) n2 = int(input("Digite um valor inteiro: ")) l t t( 2)
  • 9. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 9/11 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 clear_output(n2) n3 = int(input("Digite um valor inteiro: ")) clear_output(n3) n4 = int(input("Digite um valor inteiro: ")) clear_output(n4) n5 = int(input("Digite um valor inteiro: ")) clear_output(n5) n6 = int(input("Digite um valor inteiro: ")) clear_output(n6) n7 = int(input("Digite um valor inteiro: ")) clear_output(n7) n8 = int(input("Digite um valor inteiro: ")) clear_output(n8) n9 = int(input("Digite um valor inteiro: ")) clear_output(9) n10 = int(input("Digite um valor inteiro: ")) clear_output(n10) print(f"Os números digitados são: {n1},{n2},{n3},{n4},{n5},{n6},{n7},{n8},"       +f"{n9},{n10}") a = (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10) print("O maior número digitado é: ",(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10)) even_count, odd_count = 0, 0 for num in a:                  if num % 2 == 0:          even_count += 1        else:          odd_count += 1            print("O número de pares na lista é: ", even_count)  print("O número de ím1pares na lista é: ", odd_count) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #5)Crie um algoritmo que leia 10 números e informe o maior número lido from numpy.core.numerictypes import maximum_sctype n1 = int(input("Digite um valor inteiro: ")) clear_output(n1) n2 = int(input("Digite um valor inteiro: ")) clear_output(n2) n3 = int(input("Digite um valor inteiro: ")) clear_output(n3) n4 = int(input("Digite um valor inteiro: ")) clear_output(n4) n5 = int(input("Digite um valor inteiro: ")) clear_output(n5) n6 = int(input("Digite um valor inteiro: ")) clear_output(n6) n7 = int(input("Digite um valor inteiro: ")) clear_output(n7) n8 = int(input("Digite um valor inteiro: ")) clear_output(n8) n9 = int(input("Digite um valor inteiro: ")) clear_output(9) 10 i t(i t("Di it l i t i "))
  • 10. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 10/11 21 22 23 24 25 n10 = int(input("Digite um valor inteiro: ")) clear_output(n10) print(f"Os números digitados são: {n1},{n2},{n3},{n4},{n5},{n6},{n7},{n8},{n9},       +f"{n10},") print("O maior número digitado é: ",max(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10)) 1 2 3 4 5 6 7 8 9 10 11 12 #5)Crie um algoritmo que leia 10 números e informe o maior número lido contador = 0 maior = 0 while contador < 10:   num = int(input(f"Digite o {contador+1} número: "))   if contador == 0:     maior = num   if num > maior:     maior = num   contador +=1 print(f"O maior número é : {maior}") 1 2 3 4 5 6 7 8 #1)Fazer um programa para encontrar todos os múltiplos de 3 de 1 a 50. n = 3 while (n < 51) and (n % 3 == 0):   print(n)   if(n == 50):     break   n +=3   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ''' 2) Ler um valor inteiro (aceitar somente valores entre 1 e 10) e escrever a  tabuada de 1 a 10 do valor lido. ''' from IPython.core.display import clear_output n = int(input(f'Digite um número inteiro entre 1 e 10')) clear_output(n) while (n < 1 or n > 10):   n = int(input("Digite um valor inteiro entre 1 e 10: "))   clear_output(a)   print(f'{n} x 1 = {n*1}') print(f'{n} x 2 = {n*2}') print(f'{n} x 3 = {n*3}') print(f'{n} x 4 = {n*4}') print(f'{n} x 5 = {n*5}') print(f'{n} x 6 = {n*6}') print(f'{n} x 7 = {n*7}') print(f'{n} x 8 = {n*8}') print(f'{n} x 9 = {n*9}') print(f'{n} x 10 = {n*10}') 1 2 #3)Faça um programa que leia 5 idades e mostre na tela a média das idades lidas contador = 0
  • 11. 10/02/2022 09:01 Python_aula02.ipynb - Colaboratory https://colab.research.google.com/drive/1W_xHl2E3NZ2-7k03mDPXhw4Oj7IugkJ9#scrollTo=v84PHtU4MA0O&printMode=true 11/11 check 4s conclusão: 08:24 2 3 4 5 6 7 8 9 10 11 12 contador = 0 soma = 0 while contador < 5:   idade = int(input(f"Digite a {contador+1} idade: "))   if (idade < 0 or idade > 160):     idade = int(input("Digite um valor inteiro entre 0 e 160: "))   soma += idade   contador +=1 print(f"A idade média é:", {soma/contador}) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ''' 4) Faça um programa que leia 3 notas (de 0 a 10) e informe na tela a  média das notas lidas. ''' contador = 0 soma = 0 while contador < 3:   nota = int(input(f"Digite a {contador+1} nota: "))   if (nota < 0 or nota > 10):     nota = int(input("Digite um valor inteiro entre 0 e 10: "))   soma += nota   contador +=1 print(f"A nota média é:", {soma/contador})