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

How to use Concatenate?

A

Add ‘whole_’ in front of the string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
Q

How to use punctuation in Python?

A

punc = “!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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
9
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
10
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
11
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
12
Q

What would become of this: num + 10 % 3

A

a value of 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
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
14
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
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A
17
Q

3 Different Programming structures?

A
  1. Sequence 2. Selection 3. Repetition
18
Q

Define the Sequence Programming structure.

A

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

19
Q

Define the Repetition programming structure.

A

Code that executes multiple times. 1. While or until 2. For Loops

20
Q

What are the Data Type ‘Families’?

A

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

21
Q

Where do computers store their data?

A

Random Access Memory

22
Q

What languages do computer speak?

A

Binary (with bytes like 1000101010)

23
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 od arguments passed to a Python script.

24
Q

3 Error types.

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

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

A

The str is a string conversion function call

26
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.

27
Q

What does OOP stand for?

A

Object Oriented Programming

28
Q

What are Python libraries and name 4.

A

Additional code to import.
1. random
2. time
3. math
4. sys

29
Q

What happens when you mix ‘ and “ ?

A

Error because Python requires you stay consistent.

30
Q

Define: Newline character

A

Newline character is what is inserted when you press enter or return on the keyboard.
Example: print(“hi, end=”)

31
Q

For Macs, how do you bring up Terminal?

A

Applications>Utilities>Terminal

32
Q

How to create a new folder on Macs using the Terminal (in the OS)?

A
  1. cd Desktop
  2. mkdir NAMEOFFILE
33
Q

When would you use floats over integers?

A

Prices, as they have decimals often times.

34
Q

Define: psuedocode

A

Contains no rules

35
Q

What are the 3 basic structures?

A
  1. Sequence
  2. Selection or Decisions
  3. Loops or repetitions