renix1

Uso de lista/dicionário em Python

Apr 23rd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #  teste.py
  5. #  
  6. #  Copyright 2016 Reni <Reni@RENI-PC>
  7.  
  8.  
  9. my_list_with_names = ["Alan", "Vini", "Reni"]
  10.  
  11.  
  12. def list_use():
  13.     nome = raw_input("Digite o seu nome para incluir-lo na lista: ")
  14.     if(len(nome) <= 0):
  15.         print("Você não digitou nada demais!")
  16.     else:
  17.         print("\nSeu nome: %s" % (nome))
  18.         my_list_with_names.append(nome)
  19.         for indice in my_list_with_names:
  20.             if(indice == nome):
  21.                 print("Nome incluido: %s\n" % (indice))
  22.             else:
  23.                 print("\nNome: %s\n" % (indice))
  24. list_use()
Advertisement
Add Comment
Please, Sign In to add comment