Sezione 1. Capitolo 22
single
Find the Word Index
Scorri per mostrare il menu
Hi there, it should be mentioned that there is another function that does the same action as find(), which is called index().
Like the very similar function find(), it finds the first appearance of the word. Look at the example to clarify its usage:
1234567string = "I can manage everything" manage = string.index('manage') everything = string.index('everything') print("The index of the word manage is", manage) print("The index of the word everything is", everything)
As you may have recognized, the index() function has the following syntax:
string.index('word')
Compito
Scorri per iniziare a programmare
Here's one more simple task to increase your knowledge base.
- Find the index of the word
burning. - Find the index of the word
desire. - Find the index of the word
studying.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 22
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione