Professional Documents
Culture Documents
'Enter A Number: ' F"the Reverse of Number Is " "True It Is A Pilondrome" "Number Is Not Pilondrome"
'Enter A Number: ' F"the Reverse of Number Is " "True It Is A Pilondrome" "Number Is Not Pilondrome"
Answer:
Run:
Question 2:
Write a function capitalize (lower_case_word) that takes the lower case word and returns the
word with the first letter capitalized. E.g. print (capitalize ('word')) should print the word Word.
Then, given a line of lowercase ASCII words (text separated by a single space), print it with the
first letter of each word capitalized using theyour own function capitalize ().
Input: harry potter Output: Harry Potter
Input: all i see turns to brown Output: All I See Turns To Brow
Answer:
import string
name = input("enter any series of words:")
print(string.capwords(name))
Run:
Abcde
Question 3:
Answer:
def Fibonacci(n):
if n < 0:
print("Incorrect input")
elif n == 0:
return 0
elif n == 1:
return 1
else:
return Fibonacci(n - 1) + Fibonacci(n - 2)