[Link] is the difference between `=` and `==` in Python?
‘=’ is used for assigning values to variables, ‘==’ is used as a way of comparison
to check a condition
[Link] will be the output of this code?
```python
a = "5"
b=2
print(a * b)
```
There will be an error; a string cannot be multiplied with an integer
3. How do you take user input in Python and convert it to an integer?
The default of the input function is a string. It can be converted to integer using
the int function.
int(input(“Enter number: “))
4. What is the purpose of `if __name__ == "__main__":` in Python scripts?
5. What’s the difference between a `list` and a `tuple`?
`Both lists and tuples store multiple values. The contents of a list can be changed
in a program, but tuple is immutable, the contents cannot be changed.
6. What does this slice return?
```python
my_list = [10, 20, 30, 40, 50]
print(my_list[1:4])
```
20, 30, 40, 50
7. How do you write a function that adds two numbers and returns the
result?
def add(a, b):
return a+b
print(add(3,4))
8. What is the output of this loop?
```python
for i in range(1, 5):
print(i)
```
1,2,3,4
9. How can you handle errors in Python using try-except?
Use the try as code you want to run. Use except with an error, to define the code
that will run in case of a specific error.
10. Explain the difference between `break` and `continue` in a loop.
Break is a statement which completely comes out of the loop. Continue is used to
skip a certain value.