Skip to content

Aug 23: Group Activity: Introduction to Python

Meet in King Hall 260

Overview

  • Group Activity
  • Complete lab from Wednesday August 21

Group Activity

Group Activities

  • Form a group with the 3 or 4 people sitting at your table. Introduce yourselves. I will come around and assign you to groups in Canvas, so that you may make a single submission for the group.

  • These exercises are designed to be done before you've completed the reading or had a lesson on the topic - you just try things and enter your observations about them. We will discuss them as you go.

  • You must have Thonny installed in order to complete this activity, but only one person in the group needs to use a computer.

  • You may work write your answers on paper and submit a single paper answer for your group OR fill in the editable pdf and submit it to Canvas (only one submission per group)

  • Introduction to Python.

Here is some of the text you are required to type in the exercise - you can copy/paste from here to save time:

Model 1 – copy into the editor, and save it as hello.py

# display a welcome message
print("Welcome to Python 3!")

# give the user a compliment
name = input("What's your name? ")
print(name, "is a great name!")

Model 2 – copy ONE LINE AT A TIME into the SHELL area of Thonny and hit return/enter after each line to see the result

input("enter the mass in grams: ")
mass = input("enter another mass in grams: ")
mass
unit = input("enter the units for mass: ")
print(mass, unit)
print(mass / 2)
ten = 10
print(ten / 2)
abs(-1)
abs(-1 * ten)

Model 3 – copy one line at a time into the shell

data = 12
data
Data
Data = 34
data
Data
3data = "hello"
data3 = "world"
data3 = hello
hot = 273 + 100
273 + 100 = hot
hot
hot - 100