Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: String Slicing and Indexing | String Manipulation Essentials
Working with Strings and Data Formats

bookChallenge: String Slicing and Indexing

Taak

Swipe to start coding

Write a function that receives a string and a character, and returns the substring found between the first and last occurrence of the specified character in the string. If the character does not appear at least twice, return an empty string.

  • Find the index of the first occurrence of char in text.
  • Find the index of the last occurrence of char in text.
  • Extract and return the substring that lies strictly between these two indices.
  • Return an empty string if char does not appear at least twice in text.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me an example?

close

Awesome!

Completion rate improved to 6.67

bookChallenge: String Slicing and Indexing

Veeg om het menu te tonen

Taak

Swipe to start coding

Write a function that receives a string and a character, and returns the substring found between the first and last occurrence of the specified character in the string. If the character does not appear at least twice, return an empty string.

  • Find the index of the first occurrence of char in text.
  • Find the index of the last occurrence of char in text.
  • Extract and return the substring that lies strictly between these two indices.
  • Return an empty string if char does not appear at least twice in text.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
single

single

some-alt