CSCI 141: Lab 1

TA: Diego Llanes

Who am I?

My name is Diego and I am a CS Masters student, my hobbies include:

  • rock climbing
  • mountain biking
  • running
  • hiking
  • backpacking

Overview of the lab

This lab is mostly to get you all comfortable with the Thonny text editor / IDE

thonny fun picture, cred: real python

Installing Thonny

install page
  • go to thonny.org
  • hover over your OS
  • use the installer that makes most sense
  • follow the instructions it gives you
  • ask for help if you have questions

Setting up Thonny

thonny text editor
  • select the "view" menu from the menu bar (very top)
  • enable "program arguments" and "variables"

Installing PyTest

pip install pytest
  1. open the "tools" menu from the menu bar
  2. click "Open system shell..."
  3. type "pip3 install pytest" and hit enter
  4. wait for it to finish
  5. close the terminal if you would like!
  6. ask questions if you want to learn more about the CLI!

Cut and Paste!

let's throw the following into Thonny, and walk through it!


								name = input("What is your name?")
								name_length = len(name)
								print("Hello", name)
								print("You have", name_length, "characters in your name.")
							

Run That Code!

let's run our code by pressing the green "play button" in the top left

what happens when we run our code

check that out! just like we anticipated! our program asks us for our name and then returns the length!

Break things!

Now that we know how our program should run, lets intentionally break it so we can learn how to fix it


							name = input("What is your name?")
							name_length = len(name)
							print("Hello", name)
							print("You have", name_length, "characters in your name.")
						

Break things!

Now that we know how our program should run, lets intentionally break it so we can learn how to fix it

Run That Code!

let's run our code again by pressing the green "play button" in the top left

code with erros

it seems like python didn't recognize what we were trying to do...


maybe it's because python is case sensitive 🤔

Explore!!!

change some other stuff and see what happens!

see what fun new errors you can discover!

Pro Tips

  • ask questions
  • be curious
  • introduce yourself to the person(s) next to you
  • read the error messages
people talking

Icebreaker Activity!

Turn to the person to your left (or right if that makes sense) and ask the following questions!

  • What was the coolest thing that you did all summer?
  • What is your major?
  • What year are you?
  • Why does what you study draw you to what you study?
ice breaker