HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Quizzes
  2. /The function mirror moves the last letter of a text to the front and the first letter to the back, and does the same to the letters between them by calling itself. What does the program print?
Python ProgrammingHardHigh School (9–10)Python Essentials › RecursionPCEP (Python Institute)
StemPy LabCreated by StemPy Lab

The function mirror moves the last letter of a text to the front and the first letter to the back, and does the same to the letters between them by calling itself. def mirror(s): if len(s) <= 1: return s return s[-1] + mirror(s[1:-1]) + s[0] print(mirror("stream")) What does the program print?

Log in to save
← All Quizzes
← A function pads a word with a fill character up to a given width. It is defined like this, and then one call below is run. Which calls run with no error? Choose every correct option.A loop collects the third letter of each word in a list. A word that is too short adds a question mark instead, and the except block ends with continue. What is the output? →
More onPython Essentials › Recursion

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. A recursive function calls itself twice for each number that is two or more, and adds one each…Hard
  2. Three small functions are defined. Two of them call themselves, and one uses a loop. Which of…Medium
  3. A recursive function works on a shorter and shorter slice of a list. What does the program print?Hard
  4. A function counts calls to itself, and its only way out is a test for exactly zero. What is the…Hard
  5. A function multiplies its argument by its own result for a number two smaller, and stops at one or…Hard
All questions on this topic →

Problems on this topic

  1. A staircase has n steps. You climb one step or two steps at a time…Medium
  2. Without running anything, say how many subsets there are for lists of 5, 10 and 20 items…Medium
  3. For each function, say whether a memory (a dictionary of answers) would help, and why…Easy
  4. Write a recursive function all_positive(items) that gives True if every item of the list is more…Medium
All problems on this topic →