Codes
Answers
Input:
n = int(input("Enter the value of n: "))
first = 0
second = 1
next_number = 0
count = 1
while(count <= n):
print(next_number, end = " ")
count += 1
first = second
second = next_number
next_number = first + second
t_number = first + second
Output:
Enter the value of n: 8
0 1 1 2 3 5 8 13
Input:
def Fib(n):
if n <= 1:
return n
else:
return (Fib(n - 1) + Fib(n - 2)) # function calling itself(recursion)
n = int(input("Enter the Value of n: ")) # take input from the user
print("Fibonacci series :")
for i in range(n):
print(Fib(i),end = " ")
Output:
Enter the value of n: 8
0 1 1 2 3 5 8 13
myStr = "py py py py"
print(myStr.find("js"))
print(myStr.index("js"))
Questions
Answers
Answer accepted
Users
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us