Homework1- PETE 2060

Run the code in the first cell when you doing your assignment


In [18]:
import time
import platform
print("Current Time:",time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()))
print("Hardware Info:",platform.uname())


Current Time: Mon, 15 Jan 2018 03:14:28
Hardware Info: uname_result(system='Windows', node='PC-20170929WLJS', release='7', version='6.1.7601', machine='AMD64', processor='Intel64 Family 6 Model 60 Stepping 3, GenuineIntel')

Q1. Write a program to print your personal info as the following format:

Name: [Last Name] [First Name]
LSU email: xx@lsu.edu

In [6]:
print("Name: Wang Bin")
print("LSU email: bxw1153@lsu.edu")


Name: Wang Bin
LSU email: bxw1153@lsu.edu

Q2. Write ONE line code to print the following test content as the following format (hint: using \n \t):

[Last Name]  [First Name]
             Test2    Test3
Test4        Test5    Test6

In [7]:
print("Wang\tBin\n\tTest2\tTest3\nTest4\tTest5\tTest6")


Wang	Bin
	Test2	Test3
Test4	Test5	Test6

Q3. Write a program to finish following task:

1: Define a variable of x = the number of letters in your name

e.g. ${x=15}$

2: Compute and print the solution of the following equation (hint: input, str(val))
$${{e}^{2}}+\frac{\sqrt{\ln 5+{{\log }_{10}}x}}{2}$$

e.g. The solution of the above equation with x of 15 is 55.432645265528734


In [7]:
import numpy as np
x=15
print("The solution of the above equation with x of " + str(x) + " is " +str(np.exp(2)**2+np.sqrt(np.log(5)+np.log10(6))/2) )


The solution of the above equation with x of 15 is 55.37074131623281

Q4.

1 Use array to define three array/list to store well name, daily oil production and location
Well Name Oil Pro (stb/day) (Latitude,Longitude)
LA12 334 (123.11,343.31)
LA21 534 (713.61,546.11)
LA44 274 (353.91,566.81)
LA62 1334 (223.11,333.31)
LA71 7834 (213.61,346.31)
LA24 974 (823.91,796.21)
LA46 8334 (333.11,503.33)
LA78 6534 (163.61,596.17)
LA84 4274 (353.93,586.86)
2 Use the value from the defined array, write/using code to print out a SUMMARY REPORT of this oil field
2.3 The number of well in this oil field
2.2 Total daily oil production rate
2.3 The index, well name, oil production rate, and location in the above list of the nearest well to LA44

Summary Report Example

[Last Name] Oil Field
Number of Wells: 23
Total daily production rate: 33341 stb/day
The nearest well to LA44 is: [index] [Well Name] [Oil Production rate] [Location]

In [1]:
WellName=['LA12','LA21','LA44','LA62','LA71','LA24','LA46','LA78','LA84']
WellPro=[334,534,274,1334,7834,974,8334,6534,4274]
WellLocation=[(123.11,343.31),(713.61,546.11),(353.91,566.81),(223.11,333.31),(213.61,346.31),(823.91,796.21),(333.11,503.33),(163.61,596.17),(353.93,586.86)]