nums = [3, 5, 7]
total = 0
for i in range(len(nums)):
total += nums[i]
print(total)
What is 15?
result = 0
for num in [1, 2, 3, 4]:
if num % 2 == 0:
result += num
print(result)
What is 6?
What values does i take on during the loop?
What is printed?
def mystery(a, b):
total = 0
for i in range(a, b):
total += i
return total
print(mystery(2, 5))
What is 2, 3, 4?
What is 9?
This type of attack tricks users into giving away passwords or personal information through fake emails or websites.
What is Phishing?
A firewall mainly serves this purpose in a computer network.
What is filtering and monitoring network traffic?
This type of error occurs when the rules of Python grammar are broken.
What is syntax error?
This error happens when you try to combine incompatible data types, like adding a string and an integer.
What is Type error?
This system connects millions of computers together worldwide.
What is the internet?
This protocol is used to transfer web pages on the Internet.
What is HTTP?
This control structure allows a program to make decisions based on conditions.
What is Selection? (or if statement)
This loop repeats a block of code a specific number of times or for each item in a list.
What is For Loop?
x = 4
if x > 5:
print("A")
else:
print("B")What is B?
def mystery(x):
return x * 2 - 1
print(mystery(4))
What is 7?
nums = [1, 3, 5, 7]
for i in range(len(nums)):
nums[i] += 1
print(nums)
What is 2, 4, 6, 8?
This cybersecurity principle ensures that information is only accessible to authorized users.
What is confidentiality?
This type of hacker breaks into systems illegally for malicious purposes.
What is a black hat hacker?
This type of error happens while the program is running, often causing the program to crash.
What is runtime error?
A missing colon at the end of an if statement will usually produce this type of error.
What is a syntax error?
This device directs data packets between networks to help information reach its destination.
What is Router?
The Internet is considered reliable because it uses this approach, where many different paths can carry data.
What is redundancy?
This loop continues running while a condition remains true.
What is While Loop?
What is printed by this code?
x = 7
if x > 10:
print("A")
else:
print("B")What is B?
count = 1
while count < 5:
print(count)
count += 2What is 1,3?
letters = ["a", "b", "c"]
for i in range(len(letters)):
print(i, letters[i])
What is A, B, C?
def check(num):
if num % 2 == 0:
return "even"
return "odd"
print(check(7))
print(check(10))A strong password should include uppercase letters, lowercase letters, numbers, and symbols because it helps prevent this type of attack that tries every possible password combination.
What is Brute Force attack?
A Denial-of-Service (DoS) attack attempts to do this to a server or website.
What is overload it with traffic so legitimate users cannot access it?
This error occurs when a program runs without crashing but produces the wrong result.
What is logic error?
Accessing an index that does not exist in a list causes this error.
What is Index error?
Information sent across the Internet is broken into smaller pieces called these.
What is the final value of total?
total = 0
for i in range(1, 5):
total += iWhat is 10?
This keyword is used to run a different block of code if an if condition is false.
What is else?
word = "python"
print(word[1])
print(word[-1])
What is Y, N?
x = 10
def change():
x = 5
print(x)
change()
print(x)
What is 5, 10?
for i in range(1, 5):
total *= i
print(total)
What is 24?
Hackers install malicious software on a computer that locks files until money is paid.
What is Ransomware?
This cybersecurity practice requires users to verify identity using two different methods, such as a password and a phone code.
What is multi factor authentication? (2 factor authentication)
Trying to divide by zero causes this specific runtime error in Python.
What is ZeroDivision Error?
An infinite loop is usually caused by this type of programming mistake.
An IP address is mainly used for this purpose on the Internet.
What is identifying a device/location on a network?
This protocol securely transfers web data by encrypting communication between a browser and website.
What is HTTPS?
What is printed by this code?
count = 1
while count < 4:
print(count)
count += 1This operator checks whether two values are equal.
nums = [2, 4, 6]
nums[1] = nums[0] + nums[2]
print(nums)
What is 2, 8, 6?
numbers = [1, 2, 3]
for n in numbers:
numbers.append(n)
if len(numbers) > 5:
break
print(numbers)
What is 1, 2, 3, 1, 2, 3?
data = [4, 2, 8]
smallest = data[0]
for num in data:
if num < smallest:
smallest = num
print(smallest)
What is 2?
This encryption method uses two keys: one public and one private.
Why is HTTPS generally safer than HTTP?
What is HTTPS encrypts data sent between the browser and website?
Using a variable before it has been created causes this error.
What is Name Error?
Reading an error message carefully helps programmers identify the line number and this important information.
What is Cause/Type error?
Packet switching improves Internet efficiency because it allows packets to do this.
What is travel independently across different routes?
TCP helps guarantee reliable communication on the Internet by doing these two things.
What are checking for errors and re-sending missing packets?
What is printed?
for num in [2, 4, 6]:
if num == 4:
print("Found")What is Found?
A programmer accidentally creates a loop that never stops running. This is called this type of loop.