Answer:
Following are the code to this question:
def Fibonacci(n):#defining a method Fibonacci that accept a parameter
a = 1#defining a variable a that holds a value 1
b = 1#defining a variable b that holds a value 1
if n <= 0:# Use if to check n value
print("invalid number")#print message
elif n == 2:#defining elif that check n equal to 2
return 1#return 1
else:#defining else block
print(a)#print value of a
print(b)#print value of b
for i in range(2,n):#defining for loop to calculate series
s = a + b# add value in s variable
a = b # interchange value
b = s# hold s value
print(s)#print s value
Fibonacci(10)#calling method
Output:
1
1
2
3
5
8
13
21
34
55
Explanation:
In the above-given program code, a method "Fibonacci" is defined, which holds a value "n" in its parameter, and inside the method two-variable "a and b" is defined, that holds a value "1".
- In the next step, if a block is defined that checks n value is less than equal to 0, it will print "invalid number" as a message.
- In the elif, it checks n value is equal to 2 it will return a value that is 1.
- In the else block, it will calculate the Fibonacci series and print its value.
Answer:
The separation of HTML from CSS makes it easier to maintain sites, share style sheets across pages, and tailor pages to different environments. This is referred to as the separation of structure (or: content) from presentation.
Explanation:
I think this right don't add me right then add
Answer:
a. select show all comments on the review tab
Explanation:
Please mark me brainliest if correct
The answwer to the type of hardware is led lighting it does not need a inverter
Answer:
public class array{
public static void main(String []args){
int[] array = {2,4,7,1,9};
int num_vals = array.length;
for(int i=0;i<num_vals;i++){
System.out.println(array[i] + " ");
}
for(int i=num_vals-1;i>=0;i--){
System.out.println(array[i] + " ");
}
}
}
Explanation:
First create the class in the java programming.
Then create the main function and declare the array with values.
Store the size of array in num_vals variable by using the function array.length.
create a for loop to iterate the each element in the array and then print on the screen with spaces and newline.
it traverse the loop from first to last.
Then, again create the for loop to iterate the each element in the array and then print on the screen with spaces and newline but the traversing start from last to first.