Python_PYQ_Assignment_Full_Solutions (1)
Python_PYQ_Assignment_Full_Solutions (1)
- Interpreted language
- Dynamically typed
- Platform-independent
In Python, variable types are determined at runtime, allowing flexibility. A variable can hold different
total = 1 + 2 + 3 + \
4+5
Example:
numbers = [1, 2, 3, 4, 5]
Example:
half = len(numbers) // 2
Example:
for i in range(5):
if i == 3:
continue
print(i)
total = 0
while True:
if num == 0:
break
if num % 2 == 0:
total += num
def is_palindrome(s):
return s == s[::-1]
string = input("Enter a string: ")
if is_palindrome(string):
else:
Example:
list1 = [1, 2]