String indexes

Run Settings
LanguagePython
Language Version
Run Command
#String indexes _it shows how the info is stored in the computer selfish = "me me me" # 01234567 print(selfish[1:5]) print(selfish) #prints from 0-7 #[start] the first item in [] is called the start. It says "where do you want me to look?" #[start:stop] "Where do you want me to stop?". It stops before the number you put print(selfish[0:8]) #[start:stop:stepover] ποσα προσπερναει print(selfish[0:8:2]) print(selfish[1:]) #ends at default print(selfish[:5]) #starts at default print(selfish[::1]) print(selfish[-1]) #starts at the end of the string print(selfish[::-1]) #the reverse of the string #immutability ->strings in python cannot be changed selfish = 100 print(selfish) #you can rewrite the word but not the numbers in which the word is assigned selfish[0] = "8" print(selfish)
Editor Settings
Theme
Key bindings
Full width
Lines