Python Basics: Functions and Loops (Quiz)

Avatar image for Francisco Martínez B

Francisco Martínez B on July 31, 2023

Vamos bien.

Avatar image for ajackson54

ajackson54 on June 27, 2024

This is a continuation of my learning path. I wanted to start with the Basics Course to see where I am at. This Functions and Loops course was very good. It was easy to understand, and using IDLE. Is there any exercises for this course like there was with the Numbers course? Also, this is a problem I’ve had from the beginning on the IDLE. Experimenting and following the course uses a lot of window space. Right now to get a clear screen I’ve been exiting IDLE and re-entering it. Is there an easier way to clear the screen?

Avatar image for Martin Breuss

Martin Breuss RP Team on June 28, 2024

Hi @ajackson54, yes we do have an exercises course also for this course, if you keep moving through the Python Basics Learning Path, then you’ll get to it next: Exercises: Functions & Loops.

Clearing IDLE’s Screen

I have a solution for clearing the screen in IDLE, but it’s quite hacky… You could create a Python file, name it, and save it in your Documents/ folder, which should make it available as a module to import for the IDLE shell:

import os
import sys

def clear():
    if "idlelib" in sys.modules:
        # Print smaller chunks to avoid "Squeezed text" message
        for _ in range(20):
            print("\n" * 5)
        os.system('cls' if == 'nt' else 'clear')

Then, you can start the shell and import and run the function:

>>> from clear_screen import clear
>>> clear()

That should present you with a clean screen in IDLE. Unfortunately, there’s no straightforward solution for achieving this that I know of.

You may want to look into using a different code editor, such as VS Code or Thonny for more convenience in the built-in REPL. Or, you could start the Python REPL from your terminal program, which usually include a way to clear the screen with a keyboard shortcut.

Avatar image for ajackson54

ajackson54 on June 29, 2024

Thank you for your solution, Martin. I haven’t tried it yet but I will after I solve my new problem. I finished the Functions and Loops course and I got a check mark on every lesson except the quiz. I checked my certificate and it said 85% complete. I returned to the course and it said resume and then it brought me back to the quiz which I had already completed. I did it again, anyway, but still I couldn’t get the check mark and I’m still only 85% completed.

Avatar image for Martin Breuss

Martin Breuss RP Team on July 1, 2024

@ajackson54 there’s a button towards the top, close to the title of the resource, where you can mark the quiz as completed. That’ll update the completion percentage.

Become a Member to join the conversation.