seccion = "exPerimeNtos y datos"6 Modificar una cadena de lo que sea a mayusculas
seccion.capitalize()'Experimentos y datos'
seccion.lower()'experimentos y datos'
seccion.upper()'EXPERIMENTOS Y DATOS'
"EXPERIMENTOS Y DATOS"== seccionFalse
"EXPERIMENTOS Y DATOS"== seccion.upper()True
dir(seccion)['__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'removeprefix',
'removesuffix',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill']
seccion'exPerimeNtos y datos'
experimento = "Rayos X e Inyeccion letal"
experimento = experimento.upper()experimento'RAYOS X E INYECCION LETAL'
"3141596".isnumeric()True
experimento[0]'R'
len(experimento)25
experimento[25]--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[42], line 1 ----> 1 experimento[25] IndexError: string index out of range
experimento[-1]'L'
experimento[0:-1]'RAYOS X E INYECCION LETA'
experimento[:-1]'RAYOS X E INYECCION LETA'
experimento[:-1:3] # [inicio:final:paso] SLICING'ROX YCNE'
numeros = [1,2,3,4,5,6,7,8,9]numeros[1::2][2, 4, 6, 8]
dir(numeros)['__add__',
'__class__',
'__class_getitem__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getstate__',
'__gt__',
'__hash__',
'__iadd__',
'__imul__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__reversed__',
'__rmul__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'append',
'clear',
'copy',
'count',
'extend',
'index',
'insert',
'pop',
'remove',
'reverse',
'sort']
# for (i=0,i<10,++i)
# numeros[i]
for numero in numeros:
print(numero)1
2
3
4
5
6
7
8
9
for letra in experimento:
print(letra)R
A
Y
O
S
X
E
I
N
Y
E
C
C
I
O
N
L
E
T
A
L