Pengindeksan Negatif String Python
Pengindeksan Negatif
Gunakan indeks negatif untuk memulai irisan dari akhir string:Contoh
Dapatkan karakter dari posisi 5 ke posisi 1, mulai hitungan dari akhir string:
b = "Hello, World!"
print(b[-5:-2])
Dapatkan karakter dari posisi 5 ke posisi 1, mulai hitungan dari akhir string:
b = "Hello, World!"
print(b[-5:-2])