Challenge: Text Cache
Tâche
Swipe to start coding
Implement the string_cache() function that returns the inner() function that takes the string value and adds it to the enclosed text.
- Create the
textvariable with the value""(empty string) in thestring_cache()function. - The
inner()function should take thestringargument with the default value"". - Make the
textnon-local variable changeable inside theinner()function. - If the
stringargument is not an empty string, add this string to thetextnon-local variable. After the first string addition, the addition should be with space. - The
inner()function should return thetextenclosed variable. - The
string_cache()should return theinner()function without calling. - Call the
string_cache()function and assign the result to thetext_cachevariable.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 6.67
Challenge: Text Cache
Glissez pour afficher le menu
Tâche
Swipe to start coding
Implement the string_cache() function that returns the inner() function that takes the string value and adds it to the enclosed text.
- Create the
textvariable with the value""(empty string) in thestring_cache()function. - The
inner()function should take thestringargument with the default value"". - Make the
textnon-local variable changeable inside theinner()function. - If the
stringargument is not an empty string, add this string to thetextnon-local variable. After the first string addition, the addition should be with space. - The
inner()function should return thetextenclosed variable. - The
string_cache()should return theinner()function without calling. - Call the
string_cache()function and assign the result to thetext_cachevariable.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single