Posts

Showing posts with the label functional programming

Math Functions : Beginner's Level

Image
In this blog post, we will see how can we create simple Mathematics functions by using python programming Language, so here we go... #You can add comments in the below code and share it in the comment box :) #comments make the code easy to understand def add(a,b): return(a+b) def sub(a,b): return(a-b) def div(a,b): if a == b: return 1 elif b == 0: return ("Math Error: division by zero") else: return(float(a//b)) def mult(a,b): return(a*b) def power(a,b): c = 1 for p in range(0,b): c *= a return(c) def main(): print("-------------------------------------------") print("The available functions are the following: ") print("1-Addition\n2-Subtraction\n3-Division\n4-Multiplication\n5-Power") counter = 0 while(counter < 20): print("-------------------------------------------") print("") option = input("Enter the number from 1-5 corresponding to the above fu...

Julia : A New Programming Language

Image
After So many programming languages both high level and low level, with different names like python, java, C++ and so on, here comes Julia   with all its colors... It first appeared 6 years ago in 2012, but was not stable at that time. The stable version of Julia has been released on 8th of August, 2018. Julia is a high level programming language, the pattern in which Julia's made is called Multi dispatch . Multi dispatch is the process in programming languages that allow the program to decide which polymorphic method or function needs to run at run time. Julia permits both functional and Object Oriented Programming. The file name extension for Julia is .jl  . Julia also provides the Language Shell where you can write code and see the output.  The good news about Julia is that it is very friendly language, it allows C and FORTRAN libraries to be used in it with just a keyword ccall   .   And more importantly, it can be used with all time favorit...