Week 2: Programming Basics Flashcards

1
Q

What is a string (text)?

A

strings are used for representing textual data. A string is a sequence of characters enclosed in either single quotes (‘’) or double quotes (“”)

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

What are variables?

A

Values. Placeholder for information.

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

What will come out of Python:
print(“hello world”)

A

hello world

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

What calculation will come out of Python: original_num = 23
new_number = original_num + 1

A

24

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

punc is what?

A

Punctuation marks like commas or exclamation points

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

How to use punctuation in Python?

A

punc = “!”

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

What is the rule about having #s in variables?

A

Cannot begin with the #

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

How could you get Python to show:
4

A

print(2+2)

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

What are they called, the words that cannot be assigned to variables?

A

keywords or reserved words

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

What is a % and what is its function?

A

modulo operator and its function is division–but only the remainder.

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

What would become of this: num = 10 % 3

A

a value of 1
Which is the remainder when you divide 10 by 3.

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

How do you increase an operator and what is its shorthand?

A

age = age + 1
age += 1

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

When there are multiple math symbols, how do you tell Python to focus on a section first?

A

parentheses. Example: num = 2 + 2 (3 * 4)
or
num = ((2 * 4) * 4) + 2

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

How do you place comments in your code?

A

#

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

3 Different Programming structures?

A
  1. Sequence 2. Selection 3. Repetition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Define the Sequence Programming structure.

A

Decision or Branching. 1. Single 2. Dual Type 3. Multi-alternative type

17
Q

What are the Data Type ‘Families’?

A

Letters, Dates, Numbers (integers & floats), and Boolean (true/false)

18
Q

Where do computers store their data?

A

Random Access Memory

19
Q

What languages do computers speak?

A

Binary (with bytes like 1000101010)

20
Q

What is the argv method?

A

The argv method in the sys library is used to handle command-line arguments in Python. It stores the list of arguments passed to a Python script. It is part of the sys module, specifically sys.argv, which is a list where:

The first element (sys.argv[0]) is the name of the script.
The subsequent elements are the arguments passed to the script.

21
Q

3 Error types.

A
  1. Syntax
  2. Run Time
  3. Logic
22
Q

What is the “…str…” called in the sentence structure: print(name + “ “ + favcolor + “ “ + str(favint))

A

The str is a string conversion function call

23
Q

What does ASCII stand for and what is it used to do?

A

American Standard Code for Information Interchange. How text is used, uniform way to assign #s to letters.

24
Q

What does OOP stand for?

A

Object Oriented Programming

25
What are Python libraries and name 4.
Additional code to import. 1. random 2. time 3. math 4. sys
26
What happens when you mix ' and " ?
Error because Python requires you stay consistent.
27
Define: Newline character
Newline character is what is inserted when you press enter or return on the keyboard. Example: print("hin/end=") hi end=
28
For Macs, how do you bring up Terminal?
Applications>Utilities>Terminal
29
How to create a new folder on Macs using the Terminal (in the OS)?
1. cd Desktop 2. mkdir NAMEOFFILE
30
When would you use floats over integers?
Prices, as they have decimals often times.
31
Define: psuedocode
Contains no rules
32
What are the 3 basic structures?
1. Sequence 2. Selection or Decisions 3. Loops or repetitions