Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge | Strings
Python Data Types

book
Challenge

Tâche

Swipe to start coding

You have such string watermelon. You have to get such characters: n, m, l, a. Use only negative indexing.

Solution

string = 'watermelon'
n = string[-1]
m = string[-5]
l = string[-3]
a = string[-9]
print(n, m, l, a)

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

string = 'watermelon'
n = string[_ _ _]
m = string[_ _ _]
l = string[_ _ _]
a = string[_ _ _]
print(n, m, l, a)

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt