Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Don't Run What You Can't Read

A program can do more than print. On your computer, it can change and delete your files, and send what's in them over the internet. A program you wrote, you can read. Code from an AI, from a website or from a friend may have lines you haven't learned, and a coding agent asks you to let it run commands you may never have seen. When you can't read it, ask what it does before you run it, and say yes to an agent only once you know what its command does.

Mia keeps all of this year's walks in a file on her computer, walks.txt, with a line for each walk. She asked an AI for a program that saves this week's walks there, and got the one in the editor. You've seen open() read a file in When It Makes Things Up; here it's used in a way you haven't learned, with "w" and write().

Python on this site runs in your browser, which keeps it away from the files on your computer: here, the program can't touch anything of yours. Ask anyway. On Mia's computer, the same lines would work on her real walks.txt, and so would a program an agent runs in your project. The habit you need there is the one you practice here.

Instructions

  1. 1

    Before you click Run, attach script.py and ask what the program does, line by line, and what it does to the files on the computer it runs on. Then send it.

Back

5/7

  1. 1. What a Coding Agent Does
  2. 2. Reading a Change
  3. 3. Quiz: It Says It Works
  4. 4. What Not to Send
  5. 5. Don't Run What You Can't Read
  6. 6. Quiz: Say When It Helped
  7. 7. Summary
Next

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with: