You are on page 1of 5

University of Science & Technology, Bannu

Lab Report No: 02


Artificial Intelligence Lab
Implementation of Function and Estimating Pi Value using Monte-Carlo Simulation in Python

Submitted By: Muhammad Noman


Roll No: 42385
Batch: 5th
Semester: 8th
Due Date: 10/04/2019
Submitted To: Engr. Muhammad Dawood

Department of Software Engineering


Faculty of Engineering
Experiment #1: Objective of this experiments is to understand python modules and how to
create custom modules. You will also understand how to create functions in python, try to
practice how to pass default value to a function.

1. Make sure that you understand the concepts of assignment #1 and you have a running
code for that.
2. Create a file “distance_script.py”
3. Copy paste your code from yesterday and create a function called getDistance
4. This function can be called as
getDistance(phi_1,lambda_1,phi_2,lambda_2)
5. Make a call to the function
6. Run the file
7. Copy the code of getDistance to another file and save it with name distance.py
8. Create a new file named compute_distance.py in same directory
9. Import distance.py module by using following command
from distance import getDistance
10. Try use the command below and observe the results
If __name__ == ‘__main__’

Solution:
Here is the Call to the Function
Experiment # 2: Write a python program for estimating value of PI using monte-Carlo
Simulation.

Solution:

You might also like