Search Header Logo
Tynker Python 101 Introduction

Tynker Python 101 Introduction

Assessment

Presentation

Computers

6th - 8th Grade

Practice Problem

Medium

Created by

DiAnne Maddox

Used 14+ times

FREE Resource

11 Slides • 22 Questions

1

Python 101 Introduction Review

Tynker Lesson

Slide image

2

Today's Agenda

  • Opening -

  • Work Period -

  • Closing -

3

Open Ended

What do you know about text-based programming languages (e.g., JavaScript, Python)? Have you ever used a text-based programming language?

4

Function Calls

The command we have used so far is print(). This is called a function call.


For example, the forward() command is making a function call to the function named forward.


Here's a refresher on how to use a function call:

Slide image

5

Multiple Choice

How would you call a function named “my_function”?

1

Call my_function()

2

my_function

3

my_function))

4

my_function()

6

Multiple Choice

You are not able to call the same function twice in a row.

1

True

2

False

7

Pay Attention to What You Are Typing

When you're using programming languages like Python, the details really matter.


If you misspell one word, or if you forget even a little bit of punctuation, your code won't run!


If you get an error, read your code closely for errors. Make sure you don't forget the parentheses!

8

Multiple Choice

The parentheses at the end of a function call are optional.

1

True

2

False

9

Fill in the Blanks

Type answer...

10

Open Ended

Write sentences to answer questions

Why is it important that programmers follow the same conventions for naming things in code?

11

Open Ended

Write sentences to answer questions

What is an algorithm? How does solving a puzzle in Tynker require creating an algorithm?

12

Syntax

We call the rules for writing Python code syntax. If you don't follow the rules, your Python code won't run properly.

13

Fill in the Blanks

Type answer...

14

Open Ended

Write sentences to answer questions

What happens if you don’t follow the rules in English (for example, by not capitalizing the first word of a sentence or using a double negative) versus when you don’t follow the rules of Python (for example, by naming an identifier with a reserved word)?

15

Fill in the Blanks

Type answer...

16

Identifier Names - Unique Names

Function names in Python are a type of identifier.


When you write your own functions, variables, or other identifiers, you need to follow some rules for giving them unique names.

17

Fill in the Blanks

Type answer...

18

Python's naming conventions for identifiers:

  • Identifiers cannot have spaces in them.

  • Identifiers must begin with a letter, or an underscore _. They can nott begin with numbers!

  • Identifiers can use letters and numbers.

  • Identifiers cannot contain symbols such as exclamation marks (!), hyphens (-), periods (.), commas (,), and so forth.

  • You can use uppercase letters, but Python doesn't treat uppercase and lowercase letters the same. In other words, jump, JUMP, and jUmP are not the same identifier to Python!

19

Multiple Choice

Identifiers are only allowed to start with an underscore or letter.

1

True

2

False

20

Multiple Select

In Python, an identifier may begin with an underscore or a letter. Which of the following is a valid identifier? Select all that apply.

1

dollar_sign

2

NUM_COUNT

3

_total

4

2_count

21

Use snake_case for Long Names

If a variable or function name has several words, you'll still want to make everything lowercase. And instead of using spaces, separate words with underscores. 


Examples: first_namelast_name, game_over


You've already seen examples of snake_case convention with the turn_left() function.

22

Fill in the Blanks

Type answer...

23

Comments - #

Commenting is a way to write an explanation of your code, right within the code itself. You can write notes to yourself in your code, and it can also help other programmers understand your code if you're working together on a project.


Comments don't affect how your program runs.


Single-Line Comments

Python syntax for single-line comments is as follows:

Type the pound character # to start a new comment.

Any text after the # won't be executed. It will be documentation for your code!

24

Multiple Choice

What will display when you Play these commands?


# The next line is commented out and won't run

# turn_right()

1

The next line is commented out and won't run

2

turn_right()

3

both lines

4

Nothing

25

Multiple Choice

What will display when you Play these commands?


print("Hello")


# print("Hello there")

1

Hello

2

Hello there

3

both lines

4

Nothing

26

Multi-Line Comments - '''

Sometimes you'll want more than one line of text to describe your code.

A multi-line comment starts and ends with '''.

Any text between the start and end marker will be ignored by Python.

Here's an example:

'''

  Here are the commands to get to the treasure. First we'll

  start moving forward one square. Then we turn right so that

  we point down. Then we move forward again so we get further

  ahead. We'll be on the treasure after the last step!

'''

27

Multiple Choice

What will display after you Play this code?

'''

The rain in Spain

Stays mainly in the Plain

'''

print("My Fair Lady")

1

The rain in Spain

Stays mainly in the Plain

2

My Fair Lady

3

both lines

4

Nothing

28

Pre Assessment Before Coding


Slide image

29

Multiple Choice

Make the character jump over a gap and land on the other side.

1

jump_over();

2

jump_up()

3

jump()

4

Jump()

30

Multiple Choice

Launch an arrow that moves 5 blocks in the direction the character is facing.

1

Fire();

2

fire();

3

fire_forward()

4

fire()

31

Multiple Choice

Turn the character to the right.

1

turn_right()

2

turn_right();

3

turnRight();

4

turnRight()

32

Multiple Choice

Move the character one step forward.

1

forward();

2

Forward()

3

forward()

4

forward_()

33

Multiple Choice

Turn the character to the left.

1

turn_left();

2

turn_left()

3

turnLeft();

4

turnLeft()

Python 101 Introduction Review

Tynker Lesson

Slide image

Show answer

Auto Play

Slide 1 / 33

SLIDE