JustPaste.it

##### Factorial of a number (again)
#
# Once with while loop and once with fo
#
# Eg: For example factorial of 6 is 6*5*4*3*2*1 which is 720.
#  if number is <=0 return 1;  do it with for loop and while


#### Python Program for n-th Fibonacci number (again)
#
# Once with while loop and once with for loop
#
# Fibonacci numbers: 0, 1, 1, 2, 3, 5, 8...
# if input is 6 then output is 5


#### Sum, multiplication, average of elements in an array
#
# Do it with while loop and for loop

# Eg: input is [1,3,5,3] then output is 12


#### Largest and smallest of elements in array
#
# Eg: input is [1,3,5,3] then output is 5


#### Reverse the elements in array
#
# Use while loop and for loop
#
# Eg: input is [1,3,5,3] then output is [3,5,3,1]


#### Interchange first and last element in python list
#
# Eg: input is [1,3,5,3] then output is [3,3,5,1]


#### 9. Interchange any two elements in a list
#
# Eg: input to function is ([1,3,5,3], 2, 3) then output is [1,5,3,3]


#### 10. Multiply all elements in an array and divide it by the length
#
# Do it with for and while loop
# If the array is empty or nil return 0
#
# Eg: input to function is [1,3,5,3] then output is 45