Programming Language
Rules, Syntax, Format
Commands & Comments
Variables
Other
100
What programming language are we using in this class?

We are using python in this class

100

What is rules, syntax, and format when writing a program?

It's when you have to write the program in a specific way in order for the compiler to understand and run the program. 

100

What are comments in programming?

Commented parts of code are ignored by the compiler

100

What are variables?

You use it to store values and its value can change

100

What type of variable does the input() command return at default?

string

200

What is Python?

It's a programming language that is easy to read and use, many ways to use it, and it's very similar to speaking english!

200

What are new lines used for?

It's used to complete each command you give

200

How do you write comments? What are comments used for?

You can use comments to explain your code, make your code more readable, and prevent certain parts of your code from being executed. You write one line comments by typing "#" at the start of the comment. You can write more than two line comments by typing """ at the start of the comment and at the end of the comment.

200

How to define variables?

1. Give it a name 

2. Set the variable equal to something

200

What can numerical operations be used for or help us with? 

It can help us compute/calculate things that will take us a long time

300

What do you have to do in order to test your code?

Click the run button

300

Can you give an example of format?

Indentation

300

What is input and output?

Output is printing something on the screen and input is having the user enter information. 

300

What are the three different types of variables that we learned and what can each type of variable store?

Types of variables: int, float, string

int can store numbers with no decimals

float can store numbers with decimals 

strings can store text


300

How do you change the default type variable of the input() method? Can you give an example of code that shows how to do that?

Cast the input() command.

Example:

a = int(input())

b = float(input())

400

What is an algorithm? How does it relate to computer programming? 

It's a set of step-by-step instructions. This related to computer programming because they are both lists of very specific instructions and it's like writing a to-do list for the computer

400

Can you give an example of syntax?

When putting commands together, you get syntax.

400

What are two commands you learned so far and give an example of code that uses both of the commands?

Commands: print() and input()

Example:

a = input()

b = input()

print(a+b)              

400

Can you give an example of what you can use variables for?

I can use a variable to store the numbers 10 and 20 in my program, then access them later.

400

List all eight numerical operations and explain what each operation does. Also explain how to write each numerical operation.

Addition: +    used to add numbers and strings

Subtraction: -    used to subtract numbers

Multiplication: *    used to multiply numbers

Float Division: /  used to divide numbers (returns float)

Exponents: **   used the same way as exponents in math

Adding to a variable: +=  used to add a string or number to a variable

Mod/remainder: %     used to get the remainder when dividing numbers

Integer division: //   used to divide numbers and rounds value down (returns int)

500

What can we use programming for?

Web and internet development, desktop GUI's applications, Scientific and Numeric, Software Development, Education, Business Applications, Games and 3D Graphics, Network Programming, and Database Access

500

What is indentation and how do you write it?

Indentation is what groups together commands in what is called scope. It shows and seperates a block of code. To indent something, press "tab" or space at least once.

500

What is a command?

Each command has a specific way to write it. These details put together is called syntax

500

What are the variable naming rules?

1. Can only start with underscore or letter (no starting with numbers!)

2. Case sensitive

3. In the actual name, you can only use letters, numbers and underscores

500

A plant grows g inches each year and starts off as s inches tall. Write a program that predicts the height of the plant after n years. The values for g, s, and n will be given by the user in that order. 


Sample input:                   Sample output: 

4 3 2                                11


g is 4, s is 3, and n is 2

g = int(input())

s = int(input())

n = int(input())

inchesGrown = g * n

height = inchesGrown + s

print(height)