Function
Variable
Surprise yourself
String
100

The input() function always return a string (true/false)

Yep, this is true.

100

What is a variable in computing?

A variable is a container for storing data that can be changed in a program

100

Name a few cool things that you've done with Python

^^

100
How do add multiple strings together?

Use the = operator

200

def my_function():

     a = 50

     print(a)

print('my value a is', my_function())

Is there an error in the code snippet? If yes, what is it?


my_function doesn't return a value. Instead of printing out the value, the program will print out 'None' instead.

200

What are some rules for naming variables in Python?

can contain both letters and numbers but not only numbers; no space in between characters; must not coincide with preserved names in Python; should make sense;...

200

Name 3 data types in Python

integer, float, string

200

How do the + and * work differently on integers and strings

1+2 = 3

1*2 = 2

'1' + '2' = '12'

'1'*2 = '11'

300

Name 3 Python functions that return a value and 3 that return None

Bonus: Explain what it means for a function to return a value (+100)

input(), int(), str(),...

print(), forward(), append(),...

300

There could be several variables in a program with the same value. (True/False)

True

300

What does the interpreter do?

Translate programming language codes to machine codes and execute them.

300

mystring = "Welcome to Python Pro Year 1. Let's learn cool new things together!"

What does mystring.find('Python') returns?

What about mystring.find('python')?

find('Python') returns 11. This is the index of the first letter in the substring

find('python') returns -1 (not found). Lower/uppercases in python matters.

400

num_pizza = input('Enter the number of pizzas you order')

cost = 100

total_cost = num_pizza*cost

print('the total cost of the order is', total_cost)

What will this print out?

The number that the user enters, 100 times

400

It is possible to declare a variable in Python without giving it an initial value. (True/False)

False. In some other programming languages, this works, but not in Python nope.

400

How does program differ from an algorithm?

An algorithm lists the steps for completing a goal. It needs not be written specifically in a programing languages. In order word, it's more generic.

A program is an algorithm written in a specific programming language and can be executed by the computer.

400

mystring ="Elon Musk just bought Twitter <OoO>"

How do we the number of characters in this string? 

How can we get the substring Twitter from mystring?

len(mystring)

start_ind = mystring.find('Twitter')

if start_ind != -1:

     my_string[start_ind:start_ind+7]

500

def my_func():

     a = 100

my_func()

print(a)

What is the value of the variable a that gets printed out?

Nothing. You get an error. a is defined within the function my_func only. 

500

def my_func():

     a = 100

a = 50

my_func()

print(a)

What is the value of the variable a that gets printed out?


50

500

What else do want to be able to do with Python? What next in programming are you excited about learning?

^^

500

How do you convert an integer or float to a string and vice versa?

int(), float(), string()