0% found this document useful (0 votes)
11 views1 page

Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

num1 = float(input("Enter the first number:"))

num2 = float(input("Enter the second number:"))


print("Sum:", num1 + num2)
print("Difference:", num1 - num2)
print("Product:", num1 * num2)
print("Quotient:", num1 / num2)
if num2 != 0:
print("Quotient:", num1 / num2)
else:
print("Error: Division by zero is not allowed.")
number = int(input("Enter a number: "))
if number % 2 == 0:
print("The number is even.")
else:
print("The number is odd.")
for number in range(1, 6):
if number % 2 == 0:
print(f"{number} is even.")
else:
print(f"{number} is odd.")
fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
print("Second fruit:", fruits[1])
print("All fruits:", fruits)
numbers = [34, 12, 45, 22, 8]
numbers.append(19)
numbers.sort()
numbers.pop()
print("Second number:", numbers[1])
print("All numbers:", numbers)
my_list = [5, 3, 9, 1, 7]
reversed_list = my_list[::-1]
print("Original list:", my_list)
print("Reversed list:", reversed_list)
my_list = [5, 3, 9, 1, 7]
my_list.reverse()
my_list.append(10)
my_list.pop(0)
print("Modified list:", my_list)

You might also like