Ministério da Educação
Brasil um país de todos
Personal tools
You are here: Home Members Cicero Garrozi Disciplinas 2014 em diante Introdução à Programação Arquivos 2016-1 Algoritmos slides07-exercicios-shell.py
Navigation
Log in


Forgot your password?
 
Document Actions

slides07-exercicios-shell.py

by Cicero Garrozi last modified 2015-09-25 05:48

Click here to get the file

Size 1 kB - File type text/python-source

File contents

>>> s = 'cicero carlos da silva junior'
>>> l = list(s)
>>> l
['c', 'i', 'c', 'e', 'r', 'o', ' ', 'c', 'a', 'r', 'l', 'o', 's', ' ', 'd', 'a', ' ', 's', 'i', 'l', 'v', 'a', ' ', 'j', 'u', 'n', 'i', 'o', 'r']
>>> semvogais = [x for x in l if x not in "aeiou"]
>>> semvogais
['c', 'c', 'r', ' ', 'c', 'r', 'l', 's', ' ', 'd', ' ', 's', 'l', 'v', ' ', 'j', 'n', 'r']
>>> nome = "".join(semvogais)
>>> nome
'ccr crls d slv jnr'
>>> semvogais_semespacos = [x for x in l if x not in " aeiou"]
>>> nome2 = "".join(semvogais_semespacos)
>>> nome2
'ccrcrlsdslvjnr'
>>> 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: