Passed
What is the output of the following Python code:
```
x = 10
x += 5
print(x)
```
✔✔15
What is the output of the following code:
```
x = [1, 2, 3]
x.append(4)
print(x)
```
✔✔[1, 2, 3, 4]
1
,What is the difference between `del` and `remove()` in Python?
✔✔`del` removes an item by index, while `remove()` removes an item by value
What is a dictionary in Python?
✔✔A collection of key-value pairs
How do you access a value in a dictionary?
✔✔By using the key inside square brackets `dict[key]`
What is the purpose of the `break` statement in Python?
✔✔Exits the current loop immediately
How do you handle exceptions in Python?
✔✔By using `try` and `except` blocks
What does the `range()` function do in Python?
✔✔Generates a sequence of numbers
2
,What is the result of `len("hello")` in Python?
✔✔5
What is a tuple in Python?
✔✔An immutable sequence of elements
How do you create a dictionary in Python?
✔✔By using curly braces `{key: value}`
What is the purpose of the `global` keyword in Python?
✔✔To indicate that a variable is global and can be accessed outside the current function
What does the `join()` method do in Python?
✔✔Concatenates the elements of an iterable into a string
How do you define a class in Python?
✔✔By using the `class` keyword followed by the class name
3
, What is the result of `` in Python 3?
✔✔1.5
How do you convert a string to a number in Python?
✔✔By using the `int()` or `float()` function
What is the difference between a list and a set in Python?
✔✔A list is ordered and allows duplicates, while a set is unordered and contains only unique
elements
What is the purpose of the `continue` statement in Python?
✔✔Skips the current iteration of a loop and moves to the next one
What is the output of the following Python code:
```
x = "apple"
print(x[1:4])
```
4