Python Day 27 – String Indexing

This morning I went over indexing strings. Learned to print only certain letters of a text with the brackets[]. This was a pretty short basic refresher as I still have one final exam left (tomorrow!). I broke down “Norwegian Blue” to say “we win” with a new letter for each line with this code:

parrot = “Norwegian Blue”

print(parrot, “\n”, parrot[3],
“\n”, parrot[4], “\n”, parrot[9], “\n”, parrot[3],
“\n”, parrot[6], “\n”, parrot[8])

Have a good day!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: