python
python
def palindrome():
num=input("Enter a number ")
if num==num[::-1]:
print(f"the {num} is palindrome")
else:
print(f"the {num} is not palindrome")
print("Digit Occurances")
for digit in set(num):
print(f"{digit}: {num.count(digit)}")
palindrome()
def fibonacci(n):
if n <= 0:
print("Error the number should be greater tahn 0")
return
fib=[0, 1]
for i in range(2,n):
fib.append(fib[-1]+fib[-2])
print(f"the fibonacci sequence is {n} sequence {fib[:n]}")
try:
N=int(input("Enter a positive integer "))
fibonacci(N)
except ValueError:
print("invalid input")
2b)
def binary_to_decimal(binary):
return int(binary,2)
def ocatl_to_hexadecimal(octal):
decimal=int(octal,8)
return hex(decimal)[2:]
3a)
def analyze_sentence():
sentence=input("Enter a sentence")
words=sentence.split()
digits=sum(c.isdigit() for c in sentence)
uppercase=sum(c.isupper() for c in sentence)
lowercase=sum(c.islower() for c in sentence)
iris = load_iris()
sepal_lengths = iris.data[:, 0]