"Hello World": Print
"Hello World": Print
"""F2021376101.ipynb
# F2021376101
#Python syntax
"""
# Example 1:
print("Hello World")
# Example 2:
x = 10
y = 5
# Example 3:
if x > y:
print("x is greater than y")
# Example 4:
for i in range(5):
print(i)
# Example 5:
name = "TALAL"
print(name)
"""#Python Comments
"""
# Example 1: print("Putting '#' symbol before the words will make the line a
comment") # Example 2: for multiple lines comments we have to use '#' before every
line
# otherwise it will not work
"""
Example 3: We can aslo use triple quotation rather than using '#' before every line
"""
print("Hello, World!")
"""#Python Variables"""
def myfunc():
x = "Teacher"
print("I am " + x)
myfunc()
print("I am " + x)
"""#Python Data Types"""
"""#Python Numbers"""
# Example 1: Integer
x = 10
print(x)
# Example 2: Float
y = 5.7
print(y)
# Example 3: Complex
z = 3 + 4j
print(z)
# Example 4: Binary
binary_num =
0b1010
print(binary_num)
# Example 5: Hexadecimal
hex_num = 0x1F
print(hex_num)
"""#Python Casting"""
# Example 1
x = int(1)
print(x)
# Example 2
y =
int(2.8)
print(y)
# Example 3
z =
int("3")
print(z)
# Example 4
a = float(1)
print(a)
# Example 5
abc = bool(10)
print(abc)
"""#Python Strings"""
if myFunction():
print("YES!")
else:
print("NO!")
# Example 5: Check if an object is an integer or not:
x = 200
print(isinstance(x, int))
"""#Python Operators"""
"""#Python Lists"""
"""#Python Tuples"""
"""#Python Sets"""
"""#Python If...Else"""
# Example 3: Range
for x in range(6):
print(x)
for x in adj:
for y in fruits:
print(x, y)
# Example 5: For loop with else statement
for num in range(5):
print(num)
else:
print("Loop finished")
"""1. Calculate and print the sum, average, minimum, and maximum of the input numbers:"""
n = [1, 2, 3, 4, 5, 6]
sum_res = sum(n)
average_res = sum_res / len(n)
min_res = min(n)
max_res = max(n)
print("Sum:", sum_res)
print("Average:", average_res)
print("Minimum:", min_res)
print("Maximum:", max_res)
"""2. Create two sets, one containing even numbers and the other containing odd
---
if word == word[::-1]:
print("YES")
else:
print("NO")
set_A = {1, 2, 3}
set_B = {1, 2, 3, 4, 5}
if set_A.issubset(set_B):
print("set_A is a subset of set_B")
else:
print("set_A is not a subset of set_B")
"""5. Find and print the symmetric difference of set_A and set_B:
"""
set_A = {1, 2, 3}
set_B = {3, 4, 5}
symmetric_difference = set_A.symmetric_difference(set_B)