Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: String Slicing and Indexing | String Manipulation Essentials
Working with Strings and Data Formats

bookChallenge: String Slicing and Indexing

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

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

Свайпніть щоб показати меню

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 4
single

single

some-alt