In: Computer Science
Develop a response to the questions below, which will address the basic concepts of programming. Remember to use your textbook and other academic resources to justify your responses. Plausible responses to the questions below will also be discussed in class.
To do so, we create functions, which is called to process the passed value and returns the processed value.
For eg:-
We could write a function which would return the perimeter of a square:-
#Fibonacci function
def Fibo(x):
if x<=0:
print("Incorrect input")
# First Fibonacci number is 0
elif x==1:
return 0
# Second Fibonacci number is 1
elif x==2:
return 1
else:
return Fibonacci(x-1)+Fibonacci(x-2)
#Driver Program for the above function
print(Fibonacci(9))
The above function would return the xth fibonacci number.
In this case, that would be 21.
Here, the value of x is passed into the function when it is called, and the function passes out the value of xth fibonacci number on its completion.
In python, print() [print function] is used to display the output on the screen. It is a built-in function.
Another most common set of functions used are math functions, such as abs(), round(), sqrt(), etc.
In order to perform string operations, functions like append(), upper(), lower(), etc. are used.
Numpy is a library, used to perform operations on multi-dimensional arrays and manage them.Numpy is the one of the most essential library as other libraries such as Pandas, Matplotlib , Scipy are built on Numpy.
Pandas library is used to manage the two-dimensional data-tables in Python, in the form of a database. Data can be loaded into data frames and operations could be performed on the selected data.
Matplotlib is a data-visualisation library. It helps to understand the data in an effecient way, by providing a visual of the same. It allows to create line graphs, pie charts, histograms, etc.One can customize every aspect of the figure according to the needs.
Scipy is used to perform scientific mathematical procedures such as optimization, linear algebra, interpolation, FFT, image processing, etc. as it contains various sub-modules to perform the same.
Scikit-learn is used for data-mining and data analysis.It is used to implement algorithms on datasets and solve real-world problems.
Due to the above libraries Python is widely used in Data Science, as it helps to solve complex problems easily with its supply of large collection of libraries that help to do so.
Comment in case of any doubts.