Python Exercise: (X+ Y) (x+3 Y)
Python Exercise: (X+ Y) (x+3 Y)
Topic 1
Answer on the following:
i. Determine the area of circle with radius of 1.2 m.
ii. Display the reverse order for FirstName and LastName in one sentence.
iii. Test the user input value is within 100 to 1000.
iv. Calculate 10 user input value and give multiplication of all number.
v. Check this sentence and determine total number of vowel.
“UCSI University is a comprehensive university in Kuala Lumpur, Malaysia.”
vi. Given, x = 5. Display [Value of x is “5”]
vii. By using for loop, determine the total possible match of summations between X and
Y to give more than 50.
X = [10, 20, 20, 20]
Y = [10, 25, 30, 40]
Topic 2
Answer of the following:
Topic 3
Answer of the following:
i. By using numpy, create list of array in between 1 to 100 and display the odd number
from this array.
ii. Plot y versus x for a function of y=sin(x) from π ¿2 π . Display and test the program
whether point at coordinate (x=3, y=0.5) is on the graph.
iii. Display and test the program for AB and CD are orthogonal or not. Given:
A(1,2), B(4,6), C(3,8) and D(-3,6)
iv. The volume V of liquid in a hollow horizontal cylinder of radius r and length L is
related to the depth of the liquid h by
Develop a function to create a plot of volume versus depth. Test the program for r = 2
m and L = 5 m.
Case study
A simple force balance on a spherical particle reaching terminal velocity in a fluid is given by:
v t=
√ 4 g ( ρ p −ρ ) D p
3 CD ρ
where v t is the terminal velocity in m/s, g is the acceleration of gravity given by g = 9.80665
m/s2, ρD is the particles density in kg/m3, ρ is the fluid density in kg/m3, D p is the diameter of
the spherical particle in m and CD is a dimensionless drag coefficient. The drag coefficient on
a spherical particle at terminal velocity varies with the Reynolds number (Re) as follows:
C D =0.19−8× 10 / ℜ
4
For ℜ>350000
a) Calculate the terminal velocity for particle with ρ p =1800 kg/m3 and D p=0.208× 10
−3