COP3502C - Study for Exam 1
Find Errors in the following program assuming its goal is to print out whether 2, 3, 5 are the divisors of numbers in the range [i, total]. total = 80 for i in range(1, total): if i % 2 = 0 print(2, "is a divisor of", i) elif i % 3 = 0: print(3 + "is a divisor of" + i) elif i % 5 = 0: print(5, "is a divisor of", i)
# should be range(1, total + 1) to list all the numbers in the range of [1, total] # should use == to compare. # There should be : after if condition # should use if # integer cannot be added with string # should use if
multiple line commenting uses
''' ''' or """ """ (Triple Quotation Marks)
What is the output of the following program? print(end="'''") print("We are halfway through the course, YAY", end="!") print(end="'''")
'''We are halfway through the course, YAY!'''
Binary numbers are prefixed with ___. By convention, octal is prefixed with ___, while hex is prefixed with ___.
'0b', '0', '0x'
What is the output of the following program? def compute(a, b): >>>return a + b, a - b result = compute(8, 2) print(result)
(10, 6) because you can assume it's a TUPLE by default whenever there is a comma in the return... (if it's in [ ], then it would return a list)
what operators can be types shorthand version
+ - * / // %
"+" vs "," in python
+ adds the strings together to leave one argument , puts them next to each other with spaced to leave multiple arguments (I think)
list operator precedence
1. () 2. * , / , // , % (left to right) 3. + , - (left to right)
def print_menu(): >>>print("1. An") >>>print("2. Example") print_menu() print(print_menu())
1. An 2. Example None
4 things about variable identifiers
1. case sensitive 2. must start with a letter or _ 3. cannot be a Python reserved keyword 4. can only contain letters, numbers, or underscores
Convert the decimal number 78 to binary, octal and hexadecimal number.
1001110 116 4E
Convert the octal number 77 to a binary number.
111111 two routes: 1. divide place separately by 2 (each place should get 3 numbers back because it's octal, so two places will get 6 numbers back) as shown in pic 2. convert octal to decimal then decimal to binary
What is the output of the following program? x = 12 y = x + 2 if x % 3 == 0 else x - 2 print(y)
14
What is the output of the following program? num = 1 for i in range(1, 10): >>>if i % 2 == 0: >>>>>>continue >>>if i == 7: >>>>>>break >>>num *= i print(num)
15
What is the decimal representation of binary number 10110101?
181
What is the output of the following program? print((13 // 2) % 4)
2
what's the output a, b = 2, 3 def magic(): >>>a = "two" >>>b = "three" print(a, b) magic() print(a, b)
2 3 2 3 (the strings are only for in that function... not global)
a, b = 2, 3 def magic(): >>>global a >>>a = "two" >>>b = "three" print(a, b) magic() print(a, b)
2 3 two 3 because variable a was made global, which means it works outside the function
What is the output of the following program? sum_nums = 0 for i in range(2, 5): >>>for j in range(i + 3, 7): >>>>>>sum_nums += (i + j) print(sum_nums)
24
What is the octal representation of binary number 10110101?
265
Binary to Octal: Group _ bits at a time.
3
what is the output: def magic(*data): >>>total = 0 >>>for item in data: >>>>>>total += item >>>return total print(magic(1, 2)) print(magic(23, 100, 8, 2, 8, 7, 12))
3 160
What is the output of the following program if the user input is 3? a = input("Enter a positive integer: ") b = int(a * 3) print(b)
333
What is the output of the following program? def output_info(id, name="admin"): >>>print(id, name) output_info(3483, "user3477")
3483 user3477
Binary to Hexadecimal: Group _ bits at a time
4
What is the output of the following program? num = 2 def magic(x): >>>return num + x print(magic(num))
4
what's the output of each? How to fix if needed? def add(x, y) >>>return x + y print(add(3, 1)) print(add("Hello", "World")) print(add(3, "1"))
4 Hello World error because 1 in quotes makes it a string and you can't add two different types. Fix it by replacing y with int(y)
for i in range(4, 10, 2): print(i)
4, 6, 8 (because the third number is the "step" which is the number you count by)
What is the output of the following program when user input 4? number = input("Enter an integer: ") print(number * 2)
44
What is the hexadecimal representation of decimal number 78?
4E
Predict the output of the following code. def magic(a, b): >>>temp = a >>>a = b >>>b = temp >>>print(a, b) a, b = 4, 5 magic(a, b) print(a, b)
5 4 (because temp = 4, a = 5, and b = temp = 4) 4 5 (no return so what happened in the last function stays in that function)
predict the output of the following code. If the output is an error, state "error". a = 5 b = [11, 3, 9] def magic(a, b): >>>a = 4 >>>b[1] = 10 >>>b = a magic(a, b) print(a, b)
5 [11, 10, 9] labeled as [0, 1, 2] so 3 is replaced with 10
What is the output of the following program? num = 12 while num > 0: >>>num -= 6 >>>print(num, end=" ")
6 0
what's the output? is there an error? def plus(x): >>>x = x + 1 y = 8 plus(y) print(y)
8
What is the output of the following program? print(26.0 // 3 + 3 / 2 - 7 % 2)
8.5
What is the output of the following program? live_coding = True grade = 92 if not live_coding: >>>grade += 1 print(grade)
92
= vs ==
= is used for assignment == is used to compare two values
while loop
A loop with only a condition (no other parameters)
Continue statement
A statement that causes a loop to stop its current iteration and begin the next one
variable scope is when
A variable declared in one function is only visible inside that function (can't be used outside that indentation)
Which of the followings are valid variable names? (Select all the answers that apply) A. tic_tac_toe B. blackjack?12 C. def D. game_2048
A, D
Given the following function, please select the invalid function call. def credentials(account, password): >>>print(account, password) A. credentials("user123", "73653$%W") B. credentials(password="R3eghe$", "73653$%W") C. credentials(password="R3eghe$", account="73653$%W") D. credentials("R3eghe$", password="73653$%W")
B
Which of the following is a valid statement? (Assume num is defined as num = 9) A. 1 + 2 = num B. num = num + 8 / 2 + 1 C. num + 8 = num + 8 D. num + 2 = num
B
Global scope
Can be called anywhere in the program
should use UpperCamelCase
Class names
short circuit evaluation
Conditionals are evaluated only when needed
Choose the correct function declaration of magic() so that we can execute the following function call successfully. magic(9, 12, 4, 7) magic(7, 8) A. def magic(**kwargs) B. It is not possible in Python C. def magic(args**) D. def magic(*info)
D
What is the output of the following program? a = 4 b = 8 print(a + "3" + b)
D
convert binary 01001001 to decimal
Do these from right to left 1. count and label each number starting at 0 2. give each number a base of 2^ raised to whatever number they were just labeled 3. multiply each (base^exponent) by (original number) 4. add results together
>>> print('Dogs', 'Cats', 'Hamsters') output
Dogs Cats Hamsters
>>> print('Dogs', 'Cats', 'Hamsters', end='!\n') output
Dogs Cats Hamsters!
What is the output of the following program? game_over = False if game_over = True: >>>print("game is over") else: >>>print("You could continue playing")
Error
Programs written in the high-level language of a given type can be directly executed by CPU. A. True B. False
False
should have short, all-lowercase names
File/Module names
higher-order functions
Functions that can accept other functions as arguments
___ should generally be avoided and only be used to define constants that are independent of function
Global variables
membership operators
In and Not operators yield True or False if the left operand matches the value of some element in the right operand, which is always a container
What is the output of the following program? name = "Jessica" print(f"\"Leave now!\"{name} yelled.")
Leave now!"Jessica yelled.
def print_menu(): >>>print("1. An") >>>print("2. Example") What's the output?
Nothing, you have to put "print_menu()" do it to display the body of the function (those parentheses mean body of it)
>>> print("Python is a 'cool' language") >>> print('Python is a "cool" language') >>> print("What's a \"cool\" language?")
Python is a 'cool' language Python is a "cool" language What's a "cool" language?
>>> print('Python is\ta cool language') >>> print('Python is\na cool language') >>> print('This is a backslash: \\')
Python is a cool language Python is a cool language This is a backslash: \
WHILE LOOPS
Repeatedly executes an indented block of code as long as the loop's expression is True.
Base 10 (Decimal)
Represent any number using 10 digits [0 - 9]
Base 16 (Hexadecimal)
Represent any number using 10 digits and 6 characters [0 - 9, A, B, C, D, E, F]
Base 2 (Binary)
Represent any number using 2 digits [0 - 1]
Base 8 (Octal)
Represent any number using 8 digits [0 - 7]
What's the output: print('Current salary is' , end=' ') print(45000) print('Enter new salary:' , end=' ') new_sal = int(input()) print(new_sal) print (user_num)
SyntaxError
IndentationError
The lines of the program are not properly indented.
What is the output of the following program? nyans = 40 if nyans < 50 or 10 < 20 and nyans < 30: >>>print(True) else: >>>print(False)
True
should use lower_snake_case
Variable and method names
Logic Errors
When programs containing logic errors can be executed but generate unexpected results
when is *args used when is **kwargs used (can use any word, as long as it has the * or **)
When the number of arguments that will be passed into a function is unknown, *args could be used to denote an arbitrary number of arguments. The function parameter **kwargs is used to pass the keyword arguments. **kwargs is a dictionary.
Id()
Will return a unique id which is also known as memory address of the variable
Type()
Will return the data type of the variable passed into the function (but must put print at beginning for it to show an output)
escape sequence for single quote or double quote (only needed if printing the same type of quote used for print statement)
\' or \"
escape sequence for backslash
\\
escape sequence for newline
\n
escape sequence for tab (8 spaces)
\t
round 867.5309 up
a = math.ceil(867.5309) --> 868
cos of 2.0
a = math.cos(2.0 * math.pi) --> 1.0
what is an anonymous/lambda function
a function that uses the keyword LAMBDA and is only executed/expressed once and then there there is no more use for it. it's a one-time use function, and it won't be referred to in later stages in the code. it is simplified to only run once without taking extra unnecessary coding memory
what is a method
a function within a class
Built-in scope
all the built-in names of python, e.g., str(), list(), print() etc.
what are the logical operators
and, or, not
Or
at least one attached statement must be true for overall statement to be true
Scope
block of code where a name is visible
Break statement
causes an immediate exit of the loop
Python Interpreter
computer program used to execute python code and convert it into the machine code
while loop common error
creating an infinite loop because the loop's expression is always true
programs manipulate VALUES, which all have a certain ___, such as...
data type int 3, 44, -1 float 3.14, 2.58 str 'Hello', 'Python Course' bool True, False
Write a method identica_digits(num) that takes in an integer num in the range of 10 - 90. This method doesn't return anything. It prints out a countup starting from the integer num, and stopping when both output digits are identical. You must use a loop. Example 1 num = 18 Output: 18 19 20 21 22 Example 2 num = 66 Output: 66 Note: For coding simplicity, follow each output number by a space, even the last one. You will assume num value is always in the range of 10 - 90. There is no invalid num value passed in.
def identical_digits(num): >>>for i in range(num, 100): >>>>>>print(i, end=" ") >>>>>>if i // 10 == i % 10: >>>>>>>>>break identical_digits(66)
A prime number is a whole number greater than 1, which is only divisible by 1 and itself. Write a method is_prime(n)to detect whether a number is prime or not.
def is_prime(n): >>>if n <= 1: >>>>>>return False >>>for i in range(2, n): >>>>>>if n % i == 0: >>>>>>>>>return False >>>>>>return True
Write a method print_inverse_triangle(base) that takes in a positive integer base and prints a triangle made of asterisks with a base of the given size at the top Example 1: base = 5 Output: ***** **** *** ** * Example 2: base = 7 Output: ******* ****** ***** **** *** ** *
def print_inverse_triangle(base): >>>for i in range(base, 0, -1): >>>>>>for j in range(0, i): >>>>>>>>>print("*", end="") >>>>>>print()
State the syntax and semantic errors in the following code snippets. def square(a) >>>return a ** 2 def equation(a=1, b=1, higher_order_square): >>>higher_order_product = lambda : return a * b >>>higher_order_square(a) + higher_order_square(b) + (2 * higher_order_product(a, b)) a, b = 10, 4 print("(a + b) ^ 2 = " + equation(a, b, square))
def square(a): is missing >>>return a ** 2 positional parameter should be before keyword parameters def equation(a=1, b=1, higher_order_square): lamda doesn't have an argument remove return statement (correction: = lambda a,b: a*b) >>>higher_order_product = lambda : return a * b needs return statement >>> return higher_order_square(a) + higher_order_square(b) + (2 * higher_order_product(a, b)) a, b = 10, 4 cannot add str and int. (Correction: str(equation...) or replace + with , print("(a + b) ^ 2 = " + equation(a, b, square))
identify the keyword arguments vs positional arguments vs default value def team(name, project=RLE program): >>>print(f{name} works on {project}) team(Tom, Blackjack) team(project="Blackjack", name="Sally") team("Sally", project="Blackjack") team("Sally")
def team(name, project=RLE program): >>>print(f{name} works on {project}) team(Tom, Blackjack) # POSITIONAL (position matters) team(project="Blackjack", name="Sally") # KEYWORD (position doesn't matter if this done like this) team("Sally", project="Blackjack") # KEYWORD (position only matters if not all are keyword... then keyword must always be last) team("Sally") # uses DEFAULT VALUE of the project being RLE program because it wasn't replaced... aka there is absence of an argument in the function call
what does global do when typed in front of a variable
defines the variable outside of the function instead of just inside
convert decimal to hex
divide by 16, get (0-15) remainders
convert decimal 73 to binary
divide by 2 until you reach 0, writing the remainder each time those remainders make up the binary from bottom to top order answer: 1001001 (or 0b1001001 i think)
convert decimal to binary
divide by 2, get (0-1) remainders
convert decimal to octal
divide by 8, get (0-7) remainders
// vs /
division that returns whole number (integer) vs decimal (floating point)
what does python use to determine the types of objects when executing
dynamic typing (that's why you can't combine strings and integers etc)
what is a tuple
enclosed by parentheses and separated by comma
What is the output of the following program? num = 2 def magic(x): >>>num = num + x >>>return num print(magic(num))
error yes there is a global num, but it can't be used in the function because it is trying to use it's own local num that hasn't even been determined yet... it defines num using num + x but there was never even an initial local num = something BUT it you CAN use the global scope if there is no num on the left-hand side within that function *note: won't be in exam or quiz
what's the output and how to fix if needed def add(x,y): >>>add_nums = x + y >>>return add_nums print(add_nums)
error because variable is undefined outside function. It's only being defined in that function so you can't use it outside fix it by replacing last line with print(add(1, 5)) or by typing add_nums = add(1, 5) before the print statement
Predict the output of the following code. If the output is an error, state "error". def mystery(id="admin", password): >>>print(id, password) mystery("user123", "8773Wehg")
error, because the key word is before the positional parameter instead of after
you can print single quotes in a statement that's in double quotes and vice versa, but not the same type of quotes unless you use
escape sequences
a value or a set of operations that produce a value is called 4 52.3 10 + 5 12 * 4
expression
how to list all the numbers in the range [i, total]
for i in range (i, total + 1)
loops over each element in a container one at a time. (the container is typically a list, a tuple, a string, a set or a dictionary) used to iterate over a sequence (e.g., list, tuple, string) or other iterable object. example
for loops for val in container: >>> <statements>
if there is no return statement in the function definition, what will happen?
function will return "None"
What is the output of the following program? print("hello", end="//") print("world", end="..")
hello//world..
What is this an example of? def say_hello(func, first, last): >>>message = func(first, last) >>>print(message) def get_greetings(first, last): >>>return "Hello, I'm " + first + " " + last + "." say_hello(get_greetings, 'Bat', "Man") Output: Hello, I'm Bat Man.
higher-order function
type the code for this output (given hours is 40 and weeks is 52): Enter hourly wage: 12 Salary is 24960
hours = 40 weeks = 52 hourly_wage = int(input('Enter hourly wage: ')) Print('Salary is', hourly_wage * hours * weeks)
only executes when the file is passed to the interpreter directly. It can be used to check whether the current script is being run on its own or being imported somewhere else
if __name__ == '__main__'
Not
if the attached statement is true, then the overall statement is false and vice versa
how to store as a number (so that you can do math with it)?
int()
examples of types
integer, string, character, boolean, etc.
numbers without decimals vs with
integers vs floating points
what is a function call / method call?
invoking a function's name to make it execute
identity operators
is and is not operators checks whether two operands are bound to a single object
what is the variable identifier
it's the variable's name
___ is a file containing Python code that can be used by other ___ or script (which is passed to the Python interpreter to execute the program) examples: add.py or subtract.py
module
math library is an example of a
module
what is the output: def magic_2(**kwargs): >>> for key, val in kwargs.items(): >>>>>>print(f"{key}: {val}") magic_2(name="Lisha", module="M3", topics="function")
name: Lisha module: M3 topics: function
a loop inside of a loop
nesting
type code to get this output: Numbers are: 0 Numbers are: 1 Numbers are: 2 Numbers are: 3 Numbers are: 4 Numbers are: 5
numlist = [0, 1, 2, 3, 4, 5] for num in numlist: print(f'numbers are: {num}')
In Python, everything is an ___
object
Literals: numeric values (23, -45, 9.01) Variables Expressions these are all
operands
Addition (+) and Subtraction (-), Multiplication (*) and Division (/), Modulo operator (%) are all
operators
what is the parameter? the argument? def say_hello(name): >>>print("Hello, I'm " + name + ".") say_hello("Batman") Output: Hello, I'm Batman.
parameter: def say_hello(name): - parameter required by function (can have multiple) argument: say_hello("Batman") - arguments are values passed in parameter(s)
arithmetic operator precedence
parentheses exponent unary multiply or divide or divide with floor add or subtract
def subtract(a,b): >>>return(a-b) subtract(3,1) or print(subtract(3,1) to show output?
print(subtract(3,1)
using end=' ' in a print statement replaces what
replaced the default newline with a whitespace
what does % return
returns the remainder from division
function that reverses order of elements
reversed()
Convert binary number 01011010 to Octal
same as binary to decimal, except split the numbers into groups of three before counting from right to left 132
Convert Hex number 49 to decimal
same as binary to decimal, except use base 16
Convert binary number 01011010 to Hexadecimal
same as hex to decimal, except split the numbers into groups of four before counting from right to left 5A *DONT FORGET TO CHANGE NUMBERS >9 TO ITS LETTER
when using shorthand for operators, does the sign or equals come first?
sign equals
compiling process for compiled language and example
source code --(compiled into)--> byte code --(machine translates into)--> machine code (Ex: Java)
compiling process for interpreted language and example
source code is interpreted during execution line by line (instead of compiled) (Ex: Python)
User input is automatically a string unless
specified as another data type. (This is important for math!)
F-Strings
statement that allows a programmer to create a string with placeholder expressions that are evaluated as the program executes
def subtract(a,b): >>>print(a-b) subtract(3,1) or print(subtract(3,1) to show output?
subtract(3,1)
what's the error def team(name, project): >>>print(f{name} works on {project}) team(name="Sally", "Blackjack")
syntax error because keyword is before positional in team(name="Sally", "Blackjack")
what's the error def team(project=RLE program, name): >>>print(f{name} works on {project}) team(Tom, Blackjack) team(project="Blackjack", name="Sally") team("Sally", project="Blackjack") team("Sally")
syntax error, default value "project=RLE program" must be the last value change it to def team(name, project=RLE program):
what indicates a block of code in python
the indentation
the inverse value is not gives
the negated value of is
what are objects, and what happens before they're printed?
the objects you want to print, they're converted to string before printed
Local scope
the scope inside of a function, or the global scope if there is no function
how to remember/save the evaluation of an expression
tore it in a variable Ex: num = 4 mult = 10 * 6 sub = 84 - 36
convert from hex to decimal
use base 16 and group into 4
convert binary to anything
use base 2
convert from octal to dec
use base 8 and group into 3
A user will enter an initial number, followed by that number of integers. Output those integer's sum. Repeat until the initial number is 0 or negative. Ex 1: if the user enters 3 9 6 1 0 Then the output is 16.
user_int = 0 num_ints = int(input()) while num_ints > 0: >>>ints_sum = 0 >>>for i in range(0, num_ints): >>>>>>user_int = int(input()) >>>>>>ints_sum += user_int >>>print(ints_sum) >>>num_ints = int(input())
x = x + 3 shorthand
x += 3
is there an error? print(3 + "is a divisor of" + i)
yes, integer cannot be added with string
is there an error? if i % 2 = 0
yes, should be == for comparing
Print statements automatically insert a newline unless
you specify an end=" "
3 things that objects have
• A value: the data associated with the object, e.g. 20 or "Hello World!" or True • A type: e.g integer, string, character, boolean, etc. • An identity: a unique numeric identifier (usually refers to the object's memory address)
Single line commenting uses
#
order of evaluation/precedence (everything)
() * / % + - < <= > >= == != not and or
Precedence of All Operators
() 1 * /, % 2 +, - 3 <, <=, >, >=, ==, != 4 not 5 and 6 or 7
for hex, A through F =
10 through 15
compute 2 % 5 and explain
5 goes into 2 zero times. 5*0 = 0 2-0 = 2. The answer is 2.
What is the output of the following program? num = 2 def magic(x): >>>num = 5 >>>return num + x print(magic(num))
7
Mutable vs. Immutable and examples
An object whose internal state can be changed is mutable (list). On the other hand, immutable doesn't allow any change in the object once it has been created (string or integer)
<value_if_true> if <condition> else <value_if_false> is an example of ____ which allows ____
Ternary operator, testing a condition in a single line
NameError
The program tries to use a variable that does not exist.
All caps with underscores between words for
constants
keyword to define a function
def function_name():
Write a method print_triangle(base) that takes in a positive integer base and prints a triangle made of asterisks with a base of the given size. Example 1: base = 5 Output: * ** *** **** ***** Example 2: base = 7 Output: * ** *** **** ***** ****** *******
def print_triangle(base): >>>for i in range(1, base + 1): >>>>>>for j in range(0, i): >>>>>>>>>print("*", end="") >>>>>>print()
process of obtaining a value from an expression is called 4 is 4 10 + 5 is 15
evaluation
**
exponent
Convert Octal number 111 to decimal
same as binary to decimal, except use base 8
what do logical operators do
used to evaluate expressions as being true or false
Every ___ has: • A name • A type (integer, string, character, boolean, etc.) • Can be associated with a set of operations
variable
syntax for anonymous function
variable = lambda arguments: expression
What would be printed by the following code? If the output is an error, state "error" in the prompt. a, b = 4, 5 c = b % a + 2 print(a + c, str(a) + str(c))
7 43
And
all attached statements must be true for overall statement to be true
unary
negates a number ex: x = 5; x = -x --> -5
type the code to get this output: Enter name of best friend: Allison My best friend is Allison
print('Enter name of best friend', end=': ') best_friend = input() print('My best friend is', best_friend)
how to specify what to print at end of statement, and what's the default?
use end='end' default is '\n' (newline)
how to separate objects if there is more than one, and what's the default?
use sep='separator' default is ' ' (space)
Predict program output: product = 1 for i in range(1, 3): for j in range(1, i + 1): product *= (i + j) print(product)
24 (remember to replace product with new result and the last output is the answer)
take absolute value of -4
a = math.fabs(-4) --> 4.0
round 867.5309 down
a = math.floor(867.5309) --> 867
raise 3 to 2
a = math.pow(3, 2) --> 9.0
sin of 6.0
a = math.sin(math.pi / 6.0) --> 0.5
take square root of 2.25
a = math.sqrt(2.25) --> 1.5
computer hardware elements: 1. input - 2. processing - 3. output - 4. storage -
1. mouse/keyboard 2. CPU/GPU, RAM (Random Access Memory) 3. Monitor/speakers 4. HDD/SSD, flash drive
What would be printed by the following code? If the output is an error, state "error" in the prompt. a, b = 4, 11 c = b // 3 + a ** 2 - b % 3 ** 2 print(c)
17 (remember exponents come before mult/div)
compute 5 % 2 and explain
2 goes into 5 two times. 2*2 = 4 5-4 = 1. The answer (remainder) is 1.
ValueError
An invalid value is used - can occur if giving letters to int().
TypeError
An operation uses incorrect types - can occur if adding an integer to a string.
Select all valid identifier names. A. False B. None C. _speed_light D. 4_good E. def F. 3var G. Dollar$ H. CourseList
C, H
>>> print('Dogs', 'Cats', 'Hamsters', sep=' and ', end='!!!') output
Dogs and Cats and Hamsters!!!
>>> print('Dogs', 'Cats', 'Hamsters', sep=':') output
Dogs:Cats:Hamsters
Input()
Function is used to read user input
Print()
Function used to display object values and string literals
Global Keyword
Keyword to change a global variable in a function
Lambda
Keyword used to construct an anonymous function
what is the output of namelist = ["Bob", "Joane", "Gunther"] for names in reversed(namelist): print(f'names are: {name}')
Names are: Gunther Names are: Joane Names are: Bob
compiling process in most programming languages
Source code is compiled into machine code
'==' operator vs 'is' operator
The == operator compares the value or equality of two objects, whereas the Python is operator checks whether two variables point to the same object in memory. In the vast majority of cases, this means you should use the equality operators == and != , except when you're comparing to None
SyntaxError
When the rules of writing the statements of the programming language are violated or The program contains invalid code that cannot be understood