“Karakter Python” Kode Jawaban

cara mendapatkan huruf python string apapun

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

Karakter Python

#check if a is uppercase,lowercase,other character or digits
a=int(input('enter'))
if chr(a)>'A' and chr(a)<'Z' : #here 'A' is 65 and 'Z' is 91
        print('upper case',a,'and ascii code',chr(a))
elif chr(a)>'a' and chr(a)<'z' : # here 'a' is 97 and 'z' is 122
        print('lower case',a, 'and ascii code is',chr(a))
elif chr(a)>'0' and chr(a)<'9' :# here '0' is 48 and '9' is 57
        print('digits',a,'and ascii code is',chr(a))
else:
        print('other special',a,'andcharacter ascii code ',chr(a))
Gr@Y_orphan_ViLL@in##

Python char at

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

Jawaban yang mirip dengan “Karakter Python”

Pertanyaan yang mirip dengan “Karakter Python”

Lebih banyak jawaban terkait untuk “Karakter Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya