Year 10 S2 Digitech Revision

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

What is a syntax error in Python?

An error in the structure of the code, such as a missing colon or unmatched parentheses.

2
New cards

What does the try-except block do?

It handles runtime errors and prevents the program from crashing.

3
New cards

What does the .lower() method do to a string?

It converts all characters in the string to lowercase.

4
New cards

What is the purpose of the len() function?

It returns the number of characters in a string or items in a list.

5
New cards

What is a list in Python?

A collection of items stored in a single variable, defined using square brackets.

6
New cards

What does the append() method do?

It adds an item to the end of a list.

7
New cards

What is a function in Python?

A reusable block of code that performs a specific task.

8
New cards

What is the difference between = and ==?

'=' assigns a value to a variable, '==' compares two values for equality.

9
New cards

What does the input() function do?

It allows the user to enter data into the program.

10
New cards

What is a logic error?

An error where the program runs but produces incorrect results.

11
New cards

What is the output of: print('Hello'[1])

'e'

12
New cards

What is the output of: print('abc'.upper())

'ABC'

13
New cards

What is the output of: print(len('Python'))

6

14
New cards

What does this code do?
for i in range(3):
    print(i)

Prints 0, 1, 2 each on a new line.

15
New cards

What is the output of:
name = 'Naomi'
print(f'Hi {name}')

'Hi Naomi'

16
New cards

What does this code do?
nums = [1, 2, 3]
nums.reverse()
print(nums)

Prints [3, 2, 1]

17
New cards

What is the output of:
print('hello world'.title())

'Hello World'

18
New cards

What does this code do?
def add(a, b):
    return a + b
print(add(2, 3))

Defines a function and prints 5.

19
New cards

What is the output of:
print('abc def'.split())

['abc', 'def']

20
New cards

What does this code do?
while True:
    break

Starts an infinite loop but breaks immediately.