“Python char em” Respostas de código

como obter qualquer carta de um python de corda

Random = "Whatever"#you can put anything here
words2 = Random.split(" ")
print('number of letters:')#you can delete this line...
print(len(Random))#and this one. these lines just Tell you how many 
#letters there are
while True:#you can get rid of this loop if you want
    ask = int(input("what letter do you want?"))
    print(Random[ask-1])
Tough Termite

Python char em

>>> s = "python"
>>> s[3]
'h'
>>> s[6]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> s[0]
'p'
>>> s[-1]
'n'
>>> s[-6]
'p'
>>> s[-7]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> 
Cirex

Respostas semelhantes a “Python char em”

Perguntas semelhantes a “Python char em”

Mais respostas relacionadas para “Python char em” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código