Command Palette

Search for a command to run...

Hectal
Phase 3: Strings and Text in Depth
Python · Exercise 2 of 6 PreviousNext
Beginner

Cut a message with slices

message holds "Hello, Hectal learners!". Create four variables using slices only:

first_word is Hello. last_word is learners (without the exclamation mark; count from the end with a negative index). backwards is the whole message reversed. every_other takes every second character of the message, starting with the first.

What Check tests

  1. first_word is Hello
  2. last_word is learners
  3. backwards is the message reversed
  4. every_other takes every second character
  5. The program prints the two words

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.