Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- #Lemos a capacidade maxima do elevador
- capacidadeMax = int(input("Capacidade Maxima de pessoas: "))
- #Lemos o numero total de alunos
- totalAlunos = int(input("Quantidade total de alunos: "))
- #Emquanto houver alunos para subir ate o pico
- while totalAlunos > 0:
- #O numero de alunos nesta viagem e a capacidade maxima menos 1, para q possa subir um munitor
- viagem = capacidadeMax - 1
- #Caso exista mais vagas que o numero de alunos q resta para subir
- if (viagem > totalAlunos):
- #O numero de alunos q ira subir sera o total de alunos restantes
- viagem = totalAlunos
- #Mostramos a informação de quantos alunos iram subir
- print("Sobem {0} e 1 monitor".format(viagem))
- #O novo total de alunos para subir e o total menos os que acabaram de subir
- totalAlunos = totalAlunos - viagem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement