Advertisement
Wilgnne

Execicio 1 - Prova Python - Eng.Comp 26

May 19th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. #Lemos a capacidade maxima do elevador
  4. capacidadeMax = int(input("Capacidade Maxima de pessoas: "))
  5. #Lemos o numero total de alunos
  6. totalAlunos = int(input("Quantidade total de alunos: "))
  7.  
  8. #Emquanto houver alunos para subir ate o pico
  9. while totalAlunos > 0:
  10.     #O numero de alunos nesta viagem e a capacidade maxima menos 1, para q possa subir um munitor
  11.     viagem = capacidadeMax - 1
  12.     #Caso exista mais vagas que o numero de alunos q resta para subir
  13.     if (viagem > totalAlunos):
  14.         #O numero de alunos q ira subir sera o total de alunos restantes
  15.         viagem = totalAlunos
  16.     #Mostramos a informação de quantos alunos iram subir
  17.     print("Sobem {0} e 1 monitor".format(viagem))
  18.     #O novo total de alunos para subir e o total menos os que acabaram de subir
  19.     totalAlunos = totalAlunos - viagem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement