Introduction Flashcards

(11 cards)

1
Q

What is the Console

A

The console shows the text output of your program. It’s right beneath the Interpreter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some well known uses for Python?

A
  • Backend web servers
  • Dev Ops and cloud engineering
  • machine learning
  • scripting and automation
  • etc

It is not often used in front end apps but it is possible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is code?

A

Code is just a series of instructions for a computer to follow one after another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When giving the code multiple instructions, in what order does code run?

A

Code runs in order, starting at the top of the program to the bottom.
For example:
print(“this prints first”)
print(“this prints second”)
print(“this prints last”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Syntax?

A

“Syntax” is jargon for “valid code that the computer can understand”.
- The rules for valid code in a programming language. (this term is not exclusive to just Python, you can use this term in other program languages)

  • The rules for how expressions and statements should be structured in a language. For example, in Python, the following is correct syntax:

print(“hello world”)

While in a different programming language, like Go, the correct syntax would be: fmt.Println(“hello world”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Other than Syntax errors.
What are some other bugs in your code that you can run into?

A

Syntax errors aren’t the only kind of problems you can run into when coding, for example:

  • A bug in your logic. Your code is valid, and will run, but it does something unexpected.
  • It’s too slow. Your code is valid and does what’s expected, but it does it slowly
    (performance issues will be covered later)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens if you try to run code with invalid syntax?

A

You’ll get an error message from the Python interpreter and the code won’t execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the “Run” button do?

A

Run: For testing and debugging. There is no penalty for running your code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the “Submit” button do?

A

Submit: Runs your code, deploying to production.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you get the average number over 4 servers?

A

print((250 + 241 + 244 + 255) / 4)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When might you use a None value?

A

Set None as the default value that will be replaced later.
One usecase is to represent that a value hasn’t been determined yet, for example, an uncaptured input.

For example, maybe your program is waiting for a user to enter their name. You might start with a variable:
username = None

Then later in the code, once the user has entered their name, you can assign it to the username variable:
username = input(“What’s your name? “)

Remember, it’s crucial to recognize that None is not the same as the string “None”. They look the same when printed to the console, but they are different data types. If you use “None” instead of None, you will end up with code that looks correct when it’s printed but fails the tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly