Game Programming Level 3 Semester 1


Hello World!

 

Link to presentation showing how to link PSAT and previously taken SAT scored to Khan Academy.

https://docs.google.com/presentation/d/1mtFtwz_q39wqJq6BKkbSvmqdIuZytDSo2b9Q6pMKUSc/edit?usp=sharing 

 

Python Resources

Blender Resources

Online Course https://runestone.academy/runestone/static/Gaming3/index.html

Supplementary Textbook: Invent Your Own Computer Games with Python

Other textbook: Making Games with Python and Pygame

 

Python Website

Python Shell

The Python Standard Library (ALL Python commands)

The Pygame website 

Turtle commands

 

Tutorials:

https://www.tutorialspoint.com/python/python_basic_syntax.htm 

https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial

https://www.datacamp.com/courses/tech:python?tap_a=5644-dce66f&tap_s=75426-9cf8ad

Dictionaries: https://www.tutorialspoint.com/python/python_dictionary.htm 

 

Other Coding and Miscellaneous Help:

CodeCombat SignUp  https://codecombat.com/students?_cc=WatchPlaneBig 

CodeCombat Continue Playing

Displaying images in pygame

How to use an image for the background in tkinter

Using Images in Turtle Programs

Python 2 v. Python 3

 

Learning about Classes: 

https://jeffknupp.com/blog/2014/06/18/improve-your-python-python-classes-and-object-oriented-programming/ 

Setting up Blender on your Computer:

  1. Go to the Computer
  2. Go into the C: drive
  3. Go into Program Files
  4. Go into Blender Foundation
  5. Go into Blender
  6. Look for the Blender (application, not player) and create a shortcut on your desktop

 

Blender Tutorials

 

repl.it

https://repl.it/

 

Scoring

http://inventwithpython.com/chapter15.html 

 

 

Date
Assignment   
Details
12/17 Q & A about anything below.  
12/12-13

Semester Exam Review

Runestone:

  • All chapters' glossary
  • All chapters' tests 
  • Chapter 1 
    • Algorithms
    • Debugging
    • Errors - what they are, how to fix them
    • Different types of languages  
  • Chapter 2: Simple Python Data
    • What are values, operators, function calls, variables
    • What are, and can you identify, various data types? 
    • Variables - how they work, what they do.
    • Doing math in Python
    • What are logical operators and how are they used in a program?
    • Exercises
  • Chapter 3: Debugging 
    • What are some error types, and how can you investigate solutions?
    • Identify errors in a program. 
  • Chapter 4: Object Instances
    • Know how to set up a turtle program
    • Summary, User-defined Classes, Instances, Attributes, Methods. 
    • Summary of Turtle Methods - know what they do and how to use them in code. 
  • Chapter 5:  Sequences
    • Strings - all sections
    • Escape characters
    • Lists - all sections
    • dot notation
    • "in" and "not in"
    • concatenation and slicing 
    • mutable and immutable
    • objects
    • splitting, joining
  • Chapter 6: Iteration
    • the for loop with both strings and lists
    • flowcharts
    • accumulator pattern with both lists and strings
  • Chapter7: Conditionals
    • Binary
    • Unary
    • Nested
    • Chained
  • Chapter 8: Files (You should have some notes to help you.)
  • Chapter 9: Understanding Code
    • What is the PCE method, and can you apply it?
  • Chapter 10: Dictionaries
    • Compare dictionaries with the other types of data-holding tools (strings and lists)
    • Contrast dictionaries with the other types of data-holding tools
    • How do some of the dictionary methods work, and why would you use them?
  • Chapter 13: Functions
    • What is the syntax for defining a function?
    • Why are functions used?
    • What type of information do they produce?
    • Can you explain how parameters affect functions?
    • Can you recognize local and global variables?
    • Diagram the flow of execution of a function. Can you diagram the flow if the function calls another function?
    • What is the difference between print and return? 
  • Chapter 16: Tuples (You should have some notes to help you.)
    • In what real-life situations might tuples be used?
    • Understand packing and unpacking
    • What is the syntax for creating a tuple?

 

Turtle

  • Setup, initialize, and run a turtle program (see Ch. 4 and your own Turtle work)

 

repl.it

  • Check over programs you created. 
    • Do you know how they work?
    • Would you be able to explain the flow of execution?
    • Do you recognize code you used?
    • Can you find and name standard items such as methods, functions, parameters, tuples, lists, dictionaries, strings, integers, floats?
 
12/10-11

Review Ch. 16 test

Make Your Own Slide Puzzle

(or)

Wormy

  • Once your game is working, provide at least 5 modifications to make it uniquely yours. 
  • Comment the modifications, stating what the parameters (or coding) were and how you changed them.
  • NOTE: Modify different types of code - they can't be five color changes, for example. 
  • Save as Wormy to your Ch. 16 folder 

 

Angry Birds

  • Use Scratch or Games Factory 2 to complete a game as illustrated on the worksheet.
  • Save a Angry Birds to Scratch studio (or) Gaming 3 folder. 
  • Fill in all worksheet blanks. 
 
12/6

Finish Runestone Ch. 16

 

12/5

Early Release

Day

Read another section of RunestoneCh. 16.

Add to your notes.

 
12/4

Finish the 09graphicsAnimationAnalysis. 

Be sure to save to your Chapter 9 folder.

 

Runestone Ch. 16 Notes

 
12/3

The 3 students absent on Thursday: Spend a few minutes reviewing Chapter 8, then take the Chapter 08 Files test. 

 

Others:

  1. Update Ch. 08 notes if you do not have 100%. 
  2. Download this file and save as 09graphicsAnimationAnalysis
  3. Using the graphicsAnimation.txt from last week, explain what the lines of code mean.

 

All:

  1. Create a new folder in the Runestone folder. Name it Ch 16 Tuples
  2. In Runestone begin reading chapter 16: Tuples.
  3. Take notes. Name them Ch 16 Notes and save them to the Ch 16 folder.

 

 
11/29

Test Chapter 08 Files

Save to your One Ddrive Ch 08 folder

 

graphicsAnimation.txt

 
11/28

Test Chapter 08 Files

 

After the test continue to manipulate the soundsAndSprites file.

  • Import a different wav or mid file
  • Change the character
  • Change the window size
  • Change the background color
  • Change the object to pick up

 

Challenge: Can you figure out how to keep score?

 

Norman: See http://wphsvanvleet.pbworks.com/w/file/129594219/06_witch_list.txt for witch list directions

 

11/27

EQ: How else can I bring my own files into a Python game?

I will practice importing files into Python using Pygame.

Standard 43.05: Write code that accesses sequential, random, and direct files.

 

Bell Work

 

Classwork:

  1. Copy/paste and save the txt file as a .py file
  2. Run the .py file and observe that Python imported images and sound into the program.
  3. Dissect the .py file to learn more about pygame and how it works.

 

TEST ON IMPORTING FILES ON WEDNESDAY.

 

 
11/26

EQ: How can I bring my own files into a Python game?

I will practice importing files into Python.

Standard 43.05: Write code that accesses sequential, random, and direct files.

 

Bell Work

Open 08 Files Notes

Review how to open and close files in Python; what do these codes do?

  1. open(filename,'r')
  2. open(filename,'w')
  3. filevariable.close()

 

Classwork: 

  • Chapter 08 - finish reading the chapter together as a class
  • Add to your  08 Files Notes
  • Add a sound file to one of your previous games.
  • Add an image file to one of your previous files.
  • Review vocabulary

 

 
11/15

EQ: How can I bring my own files into a Python game?

I will practice importing files into Python.

Standard 43.05: Write code that accesses sequential, random, and direct files.

 

Bell Work

Open 08 Files Notes (we started this on Monday)

Review how to open and close files in Python; what do these codes do?

  1. open(filename,'r')
  2. open(filename,'w')
  3. filevariable.close() 

 

Classwork: 

  • Chapter 08 - finish reading the chapter together as a class
  • Add to your  08 Files Notes
  • Add a sound file to one of your previous games.
  • Add an image file to one of your previous files.

 

https://pastebin.com/t8KMexkp  

 

 
11/13-14 Ch. 10 extra exercises as group and individual work.  
11/12

EQ: How can I bring my own files into a Python game?

I will practice importing files into Python.

Standard 43.05: Write code that accesses sequential, random, and direct files.

 

Bell Work:

Create a folder in Gaming 3. Name it 08 Files

Create a Word document in the 08 Files folder. Name it 08 Files Notes

Obviously this will be used to take notes as you read Ch. 08.

 

Classwork:

Together as a class read through the first 4 modules of chapter 08.

Create a text file - save and open in Python.

How can this be applied to a game situation?

 
11/7 - 11/8

EQ: How can a dictionary be used in fun activity?

I will create and use a dictionary to create fun pirate-speak sentences.

Standard: 43.07 Enter and modify source code using a program language editor; 43.08 Code routines within programs that validate input data.

 

Bell Work:

Ensure all assignments for RA 9 and 10 are completed and turned in.

Review student-led question review.

Redo ch. 7 test with blue highlighting.

 

Classwork:

Repl.it - Pirate

Create code according to the directions in repl. The idea is to use a dictionary to swap English words with Pirate-speak. Aarrgh! Get to work, ye landlubbers, or ye be swabbin' the decks!

This is due November 9 (Thursday) at the end of class.

 
11/6

EQ: What is the difference between a list and a dictionary?

I will check my understanding of dictionaries and lists.

Standard: 41.01 Develop a plan for testing programs; 41.03 Perform debugging activities 

 

Bell Work:

08-EPC should be renamed 09-EPC and moved to the Chapter 9 folder.

The other document from yesterday should be named 10-RA-Questions and placed in the Ch. 10 folder.

The chapter 9 folder can be named Ch 09 Understanding Code.

 

Create a Word document in Ch. 9 folder. Copy/paste the 5 questions below.

Save as 09-EPC2

 

Explain, Predict, Check:

1. What will be returned after this code snippet runs?

favorites1 = {'fruit':'apples', 'number':42, 'animal':'cats'}

favorites2 = {'animal':'cats',  'number':42, 'fruit':'apples'}

favorites1 == favorites2

(Is this statement true or false? Explain your answer.)

 

2. What will be returned after this code snippet runs?

favorites = {'pie':'apples', 'pets':'cats', 'Robinson':42}

for k in favorites:

    print(k)

 

3. What will be returned after this code snippet runs?

favorites = {'pie':'peach', 'pets':'dogs', 'Robinson':'Jackie'}

for k in favorites:

    print(favorites[k])

 

4. What will be returned after this code snippet runs?

listFavs1 = ['apples', 'cats', 42]

listFavs2 = ['cats', 42, 'apples']

listFavs1 == listFavs2

 

5. Create a question for your shoulder partner in the space below. Allow him/her to explain, predict, and check. After y'all are done, write the correct answer below your code.

 

Classwork:

  • Check your Hangman game. Notice it used a dictionary to support different sets of secret words by using a dictionary.
  • Complete all the "Extra Exercises" in Runestone Ch. 10. 
    • Once you get the code to run in the first exercise, copy/paste the code into a new Word doc.
    • Number the code with the same number shown in Runestone (eg. 1, 1.1, 1.2, etc.)
    • Continue until all code is in the Word doc. Save as 10-extraExercises to your Ch. 10 folder in OneDrive
    • This activity is due today. 
  • If time permits, go to repl.it and begin the pirate assignment.

 

 
11/5

EQ: What is the difference between a list and a dictionary?

I will explore some common operations used with dictionaries.

Standard :

 

Bell Work:

Be sure 09-EPC is in  your Chapter 9 Runestone folder.
 
Classwork

  1. Ch.10 Runestone - Dictionaries. 
  2. Pay close attention to the glossary words.
  3. The first 5 modules in Dictionaries must be completed by the end of class today..
  4. Answer the following questions in a Word doc. Save as 10-RA Questions 

 

  • What is the difference between a list and a dictionary?
  • What does it mean when it uses the term "mapping type?"
  • What is the difference between aliasing and copying?
  • What are some common operations you can do with a dictionary?
 

11/1

Block Day

EQ/I will/Standard - see 10/31

 

Bell Work:

  • Each team has a snippet of code from a Memory game.
  • Use Explain, Predict, Check to figure out what the code does.
  • As each team explains their code, take notes for their code snippet as well.
  • Use the document below to record your notes. 
  • Save this document as 09_EPC to your Gaming 3 chapter 09 folder.

 

08 Explain-Predict-Check

 

Classwork:

  1. Begin Ch. 10 Runestone - Dictionaries. 
  2. Pay close attention to the glossary words.
  3. The first 5 modules in Dictionaries must be completed by the end of class on Monday.

 

 
10/31

EQ: How does a program utilize user input to drive the code?

I will examine code from a game and dissect it to determine how it works.

Standard 66.11: Write event-driven programs.

 

Bell Work:

Be sure Tic-Tac-Toe works in Repl.it

 

Classwork:

Examine various hash tag comments. Explain to the class how that code segment accomplishes what the # says it will do.

 
10/30

pygame 

  1. Watch the video https://www.pygame.org/news to see what you can make.
  2. The Newbie Guide has a great tutorial for beginners.

 

Fill in areas of the spreadsheet as you find code.

  1. Put your initials in the spreadsheet.
  2. This will be a "textbook" for us. 

https://docs.google.com/spreadsheets/d/16g4inEOY03RXe2v4Rib6plbfxwZECX74w9muUWR7fBc/edit?usp=sharing  

 

 

10/29

EQ: What steps are commonly used to debug a program?

I will use repl.it to assist me in finding errors in my code.

Standard 64.03: Perform debugging activities.

 

Hill: Take the Ch. 6 test

 

Benitez, Doher, Hernandez, and Hill: Take Chapter 07 test.

 

Classwork:

Runestone: Chapter 09: Understanding Code (due today)

Read this and be sure all four modules are marked complete before moving on to Repl. You will use the information in Runestone as you work through the Repl project.

 

Repl.it - in the Project (not Assignments) area

  1. type the code from this Tic-Tac-Toe text document into repl.
  2. run the code
  3. debug if necessary due at beginning of class on Wed.

 

 

10/22-10/25

See 10/18 for standard, EQ and I will statements.

Chapter 07: Conditionals

Monday,

  • Review Runestone Ch 02:Boolean values and expressions, logical operators
  • New material: Ch. 07 Conditionals instruction

Tuesday: Runestone instruction

  • Begin with Unary selection video --> Glossary
  • 07 Conditionals Practice (includes the exercises at the end of the chapter)
    • Save with the same file name, place in Ch 07 folder on OneDrive. 

Wednesday: 

  • 07 Conditionals Practice  
  • Self-correct test - go to your Chapter 06 test. Fix errors, mark them with a bright blue highlighter.
  • Check repl.it. Resubmit any outstanding work.
  • Witch List - If you completed it outside of Repl.it, put your name on the whiteboard. 

Thursday: Using conditionals in your own program.

Test Chapter 07

 

10/18

Block day

EQ: What is a loop, and how does it affect program flow?

I will create a flowchart showing a conditional statement and its resulting changes to program flow.

Standard 79.06: Code programs using logical statements (e.g., if-then-else, do...while).

Complete the chapter, do the exercises, review glossary.

06_witch_list

06 Iteration Test

 

Begin Ch.07: Conditionals

 
10/17

Runestone Academy Chapter 06 Iteration, modules 4, 5, 6, 7.

(Traversal through Accum with Lists)

You will learn the Accumulator Pattern with lists and strings.

 

TEST- Chapter 06 Iteration on Thursday.

 

 
10/16

EQ: How does a program repeat code over and over?

I will create iteration code on strings and lists with for loops.

Standard 47.03: Write programs that use iteration. 

 

Runestone Academy Chapter 6 Iteration, first 4 modules

  • Learn to use a for loop with list names and strings.

 

Write working iteration code for 3 lists and 3 strings. Repl.it 06_iterationPractice1 

 

 
10/10

http://inventwithpython.com/invent4thed/diff/#diff 

Use the code above to compare your code with a code that works.

 

Try this. Compare your code to the one below.

hangman_leamer

 
10/8

Standard, EQ, and I will are shown on 10/1.

 

Bell Work:

To the best of my knowledge, all work is graded. Check Skyward for missing work.

 

Classwork:

In repl.it type the code for 13 Hangman.

We will discuss this as we go.

 

10/4

Block Day

Bell Work:

Create 3 functions which use the return statement. Take screen shots showing the code and the results of running the code. Put the screenshots in a Word doc. Save as Function Practice 01 to your Ch. 13 folder. 

 

https://repl.it/@vanvleek/ProperRewardingProlog 

 

13 Functions Worksheet (7 questions)

 

Classwork:

In repl.it type the code for 13 Hangman.

We will discuss this as we go.

 
10/3

Bell Work:

Please set up your Runestone Academy folder so it contains the folders shown here. Use the same folder names, please.

 

 

Classwork:

Practice making some functions.

 

 
10/2 13 Functions Worksheet.docx   Due today at the end of class.  
10/1

EQ: What is the purpose of a function in Python?

I will write functions that use global variables.

Standard 76.05: Execute programs and subroutines as they relate to the total application.

 

Classwork:

Runestone Academy Chapter 13 "Functions" 

Today - complete through "Global Variables"

 
9/27

See 9/24 for EQ, I will, and standard.

 

Please do these things in order:

  1. Your chapter 5 "Lists" test is graded. 
    1. YOU MAY NOT TALK OR SHARE DURING THIS PART OF CLASS.
    2. I removed some of the questions - they are crossed out and do not count toward your grade. 
    3. Correct your quiz using Runestone as a resource.
    4. Do not remove any yellow or red notations. 
    5. Use the bright blue highlighter to show your new answers. 
    6. This is the only day you will have to edit your test. 
  2. Try to create the Color Game.
    1. Did every team uploaded their code to the shared Notepad? If not, please do so.
    2. Each person:
      1. Begin making the Color Game using the shared code. 
      2. Consider Notepad as a library of code. Many programmers use code from a communal library instead of writing every bit of code from scratch.
      3. This is not considered plagiarism. If the code is a community code library, the people who wrote the code are sharing it for free. Kinda like Creative Commons.
      4. If you use code that is not in a community library you must get permission, and then, if allowed to use the code, give credit to the programmer who figured it out.

 

 
9/25-26

See 9/24 for EQ, I will, and standard.

 

Bell Work:

Research your assigned topic with your partner. Be prepared to state how the information might be used in a game.

  1. Make a list of 10 possible colors Lewin, Hernandez
  2. How to randomly choose a color in the list. Lewin, Hernandez
  3. How to make each color word, such as black or red, display in one of the 10 colors. Clement, McDearmid, Hill
  4. Countdown timer showing the amount of time left in the game Benitez, Whitmore
  5. How to keep score, increasing by one point for each correct answer. Ford, Lockwood
  6. How to make a text entry box Doher, Davila
  7. How to clear an input or entry box after user types an answer Doher, Davila
  8. A function that will start the game, initiating the countdown timer and the function to choose the next color. Marquis, Fitzpatrick

 

Link to Notepad for recording your code:

https://marionstudents-my.sharepoint.com/:t:/g/personal/kathy_vanvleet_marion_k12_fl_us/EYYYp1At9mtOua-GNEdEo0oBgzjVI7xDmzIeB_LMj5am2w?e=SeLNS1 

 

 

Classwork:

Color Game using tkinter

 

 
9/24

EQ: What is tkinter?

I will write a program using the tkinter module.

Standard 66.07: Write code that accesses sequential, indexed sequential, random, and direct files.

 

Bell Work:

Review how to draw with Turtle.

  • Import
  • create window
  • create canvas
  • use commands to draw

 

Classwork:

Import tkinter

Compare/contrast with Turtle

Make a clickable button that responds to user input.

 
9/20

Lists Test

 

When you finish the test:

  • You may listen to music.
  • Continue working in Runestone Ch. 13
  • Begin working on Dragon Realm in repl.it If you don't know how to define functions, go back to Ch. 13 in Runestone.
 
9/18 -19

List worksheet is due today.

Lists in repl.it due at the end of class Wednesday.

 

If you finish early:

Study for the Lists test on Thursday.

Create a folder in Gaming 3 called Chapter 13 Functions.

  • Begin working your way through the modules.
  • Take notes in Word and save to the Ch. 13 folder. Make notes of the important code and rules you think you should remember.

 

Lists test on Thursday. 

JC: Hangman
9/17

Bell Work:

Complete the Ch. 5 part 2 Worksheet and save to the Ch. 5 folder in OneDrive.

 

Classwork:

Kahoot on Lists

Continue working on Lists activity in repl.

 
9/12-13
  • Download the Ch. 5 part 2 Worksheet.
    • This is open book.
    • Try to answer all questions.
    • Due at the end of class on Thursday.
  • "Try" the activity named "Lists" in repl.it.
    • See how you do with manipulating the lists.
    • Collaborate as needed, but don't give each other the code. Just make suggestions of things that might be needed or that might work.

I am delaying the test over Lists until next Thursday. We need more practice with this important command.

 
9/11

Continue working through the list section of the Sequencing  chapter. 

 

 

 
9/10

EQ: How does a program flow as it is executed?

I will use sequencing to create a linear program flow.

Standard 79.05:Write code that accesses sequential, indexed sequential, random, and direct files.

Bell Work:

  • Check Skyward for missing work. Find it, complete it, and put it in the Gaming 3 folder before end of the day today.
  • Review Ch. 3 Debugging in Runestone Academy
  • Create a new folder in your One Drive. Name it Ch03_Debugging. You will save today's test in this new folder.
  • Do you have folders for Ch01_general_Intro, Ch02_simplePythonData, and Ch04_object_Instances? If not, create them (or rename them) and move the tests or other assignments to the correct folder. 

 

Classwork:

  1. Runestone Academy: Chapter 03 Debugging Quiz
  2. After the test: Complete "Jokes" and save to repl.it
  3. Go to Runestone Ch. 4 "Sequencing." Begin with Lists and complete the chapter. 

 

 

 

 

9/6

Block Day

EQ: What steps are commonly used to debug a program?

I will use repl.it to assist me in finding errors in my code.

Standard 76.06: Use trace routines of compilers to assist in program debugging.

 

Use Repl to code the next game.

 Invitation Link: https://repl.it/classroom/invite/Y0GH8CL  
9/5

EQ/I will/Standards: See 9/4

 

Bell Work:

  • Be sure yesterday's screenshots are in the Chapter 5 folder. See file name below.
  • Be sure RA Q&A is in the Chapter 5 folder.

 

Classwork:

  1. Download and open Guess My Number
  2. Retype the code into IDLE.
  3. Run the program
  4. Debug if necessary.
  5. Play the game.
  6. Save the python file as guessNumber.py 

 

 

 

 

9/4

EQ: How are stings used in Python?

I will demonstrate several string methods' application.

Standard 76.08 Write programs using object-oriented languages.

 

Bell Work:

Download RA Q&A.

 

Classwork:

Runestone Ch. 5: Sequences (see details)

Take a screenshot displaying the running of your assigned string method(s).

Save as ch5_SequencesScreenshots

 

Homework:

Download RA Q&A.

Complete this on your own.

Save to your Gaming 3 folder. No need to change the file name.

 

 

 

 

 

 

 

 

 

 

 

Runestone details:

Read and complete activities from "Introduction" to "String Methods."

 

Each team will create and run code using a teacher-assigned method discussed in String Methods.

 

 

8/30

Bell Work:

  • Review Unit 4 Object Types 
  • Finish and turn in the turtle commands assignment from yesterday.

 

Classwork:

  1. Runestone Unit 4 Test
  2. Complete CodeCombat first 21 levels (Kithgard Dungeon)

 


 
8/29

EQ: What resources are available to me when I program in Python?

I will use Runestone academy and various websites (see resources above) to help me code.

Standard 66.01: Utilize reference manuals.

 

Bell Work:

Review Method, Class, Attribute and Instance

 

Classwork:

Use Python or other resource and successfully try all the turtle commands possible.

 

Create an exit ticket in Word showing the code and the resulting screenshot for at least 3 new commands.

Save as lastname_turtleCommands to your Gaming 3 Chapter 4 folder.

 

Use Runestone and/or other source to understand what these parts of Python mean, what they do, how they are coded, etc.

 

 

 

8/28

EQ: What are object-oriented programs?

I will program an object using the turtle module.

Standard 70.08: Write programs using object-oriented languages.

 

Finish the Object Instances section of Runestone.

Complete the Exit ticket.

Legal colors names for Python

What are classes, modules, instances, and methods? Can you identify them?
8/27 Review Ch.1 and Ch.2 tests  
8/20-23 

EQ: What are data types, and what are some common ones I will see?

I will distinguish between different types of integer data types.

Standard 63.09: Distinguish among integer, fixed-point, and floating-point calculations.

 

Runestone Section 2 "Simple Python Data"

Test on 8/23

  • turning numbers into strings
  • integers and floats
  • modulus
  • print()
  • type()
  • square()
  • commas in numbers
  • escape characters (See below and the note here -->
  • variables
  • = and ==
  • order of operations
  • comparison operators
  • logical operators
  • mathematical operators 

 

 

Update for Data Types section:

Python 3 may require an Escape character if you use quotes and apostrophes within the original string quote marks. See details -->

 

 

___________________________________

Statements and Expressions section:

The "square" function no longer exists. Use one of the ideas shown here -->

 

 

 

 

 

_____________________________________________

Runestone uses raw_input ( ) as a function. 

In Python 3 this function is input( ) 

 

02 Simple Python Data Quiz

Read all sections of this topic

 

 

print (' ' ' "Oh no", she exclaimed, "Ben's bike is broken!" ' ' ')

The different kinds of quote marks create a hierarchy. The 3 ' ' ' marks is the highest level. The next lower level are 2 marks " and the lowest level is a single mark ' . This example uses the 3 levels, and Python recognizes each level as a separate command.

 

However, look at the following example:

print ('What does a dentist call an astronaut's cavity?')

if you use a single quote at the beginning and end, then the apostrophe in the word astronaut's is seen as the end of the string. Copy/paste the above print command into the Python shell and see the result.

 

So how is this fixed? Use an escape character - in this case the backslash - before the apostrophe in the word astronaut's. It would look like this:

print ('What does a dentist call an astronaut\'s cavity?')

 

Try this new command and see the difference.

 

 

 

____________________________

To square a number, you may do one of the following:

  • Use the ** exponent operator, like this: 3**2 which means 3 to the 2nd power.
  • Use the pow function. pow(3,2) which means raise 3 to the power of 2.
  • Define a variable named square and set it equal to 3 **2.
    square = 3**2 

 

__________________________________ 

 

8/13-8/16

 

EQ: What is Python?

I will investigate Python via Runestone Academy.

Standard 63.01: Identify characteristics of high-level languages.

 

Bell Work:

Check your phone number in Remind.

Sign up for Runestone Academy

  1. Use your school username, password, and email
  2. Choose the course name as shown here --->

Sign up for Code Combat.

  1. Use your school username, password, and email
  2. Class Code: WatchPlaneBig 

 

In Class: Become familiar with Runestone, Python shell, IDLE, Code Combat, and turning in work.

 

Homework:

  1. Read the all of the General Introduction - including the Glossary.
  2. Complete the activities in the online textbook.  See Note here -->

 

Test on 8/17 over General Introduction

01 General Introduction Quiz

 

 

 

NOTE: in the activities, the online course is using Python v. 2. We will be using v. 3. You may have to adjust your code to avoid syntax errors on the Print command. See the link in the resources area above.

 

For example, In the section "A Typical First Program" the code given is

print "Hello, World!"

However, the code should include parentheses, like this:

print ("Hello, World!")

8/13

In Class:

  1. School review Powerpoint
  2. If you were on Remind last year with me: Check Remind for correct phone number.
  3. If you were NOT on Remind last year with me: Sign up for Remind. Text @p3game to 81010
NOTE: I moved you from Gaming 2 to this class, just check the phone number.

 

Code Combat Clan: https://codecombat.com/clans/5b759e6e878b320028f7ea32