Advertisement
ph4x35ccb

main class atributos

Feb 4th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #! user/bin/env/ python
  2. # coding: UTF-8
  3. #class https://pastebin.com/aT8ktqCf
  4.  
  5. import carro
  6.  
  7. #help(carro.Carro)
  8. uno_vermelho = carro.Carro("vermelho",4,"Flex", 1.0) #var uno_vermelho chma classe carro definino AS CARACTERISTICAS DO CARRO
  9. uno_vermelho.ligar()#metodo ligar
  10. uno_vermelho.abastecer(50)#metodo abastecer
  11. uno_vermelho.abastecer(10)
  12. uno_vermelho.acelerar(0)#metodo acelerar
  13. print(f"A quantidade de combustivel é: {uno_vermelho.qtd_combustivel}")
  14. del uno_vermelho
  15.  
  16. uno_preto = carro.Carro("preto",2,"Flex", 1.4) # var chma class Carro e define caracterista  do carro
  17. uno_preto.desligar()
  18. uno_preto.acelerar(20)
  19. uno_preto.ligar()
  20. uno_preto.abastecer(20)
  21. uno_preto.acelerar(20)
  22. print(f"O carro  foi acelerado em: {uno_preto.velocidade}")
  23. print(f"A quantidade de conbustivel  do uno preto é: {uno_preto.qtd_combustivel}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement