Week 2: Programming Basics Flashcards
What is a string (text)?
strings are used for representing textual data. A string is a sequence of characters enclosed in either single quotes (‘’) or double quotes (“”)
What are variables?
Values. Placeholder for information.
What will come out of Python:
print(“hello world”)
hello world
What calculation will come out of Python: original_num = 23
new_number = original_num + 1
24
punc is what?
Punctuation marks like commas or exclamation points
How to use punctuation in Python?
punc = “!”
What is the rule about having #s in variables?
Cannot begin with the #
How could you get Python to show:
4
print(2+2)
What are they called, the words that cannot be assigned to variables?
keywords or reserved words
What is a % and what is its function?
modulo operator and its function is division–but only the remainder.
What would become of this: num = 10 % 3
a value of 1
Which is the remainder when you divide 10 by 3.
How do you increase an operator and what is its shorthand?
age = age + 1
age += 1
When there are multiple math symbols, how do you tell Python to focus on a section first?
parentheses. Example: num = 2 + 2 (3 * 4)
or
num = ((2 * 4) * 4) + 2
How do you place comments in your code?
#
3 Different Programming structures?
- Sequence 2. Selection 3. Repetition
Define the Sequence Programming structure.
Decision or Branching. 1. Single 2. Dual Type 3. Multi-alternative type
What are the Data Type ‘Families’?
Letters, Dates, Numbers (integers & floats), and Boolean (true/false)
Where do computers store their data?
Random Access Memory
What languages do computers speak?
Binary (with bytes like 1000101010)
What is the argv method?
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.
3 Error types.
- Syntax
- Run Time
- Logic
What is the “…str…” called in the sentence structure: print(name + “ “ + favcolor + “ “ + str(favint))
The str is a string conversion function call
What does ASCII stand for and what is it used to do?
American Standard Code for Information Interchange. How text is used, uniform way to assign #s to letters.
What does OOP stand for?
Object Oriented Programming