“Python Char an” Code-Antworten

So erhalten Sie einen Brief von einem String -Python

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 an

>>> 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

Ähnliche Antworten wie “Python Char an”

Fragen ähnlich wie “Python Char an”

Weitere verwandte Antworten zu “Python Char an” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen