# Write a function to calculate the pressure P of ideal gas based on ideal gas equation - Volume V, and Temperatue T are given - Python

Categories:
Viewed: 7 - Published at: a few seconds ago

### Write a function to calculate the pressure P of ideal gas based on ideal gas equation - Volume V, and Temperatue T are given

``````def find_pressure_of_ideal_gas(volume:float, temp:float,n:float)->float:
r = 8.3145 # gas constant R
return (n*r*temp)/volume
``````

### Write a function to calculate the volume V of ideal gas based on ideal gas equation Pressure P and Tempreature T given

``````def find_volume_of_ideal_gas(pressure:float, temp:float,n:float)->float:
r = 8.3145 # gas constant R
return (n*r*temp)/pressure
``````

### Write a function to calculate the Temprature T of ideal gas based on ideal gas equation Pressure P and Volume V given

``````def find_temp_of_ideal_gas(pressure:float, volume:float,n:float)->float:
r = 8.3145 # gas constant R
return (pressure*volume)/n*r
``````

### Write a function to calculate the velocity of an object with initial velocity u, time t and acceleration a

``````def cal_final_velocity(initial_velocity:float,accelration:float,time:float)->float:
return initial_velocity + accelration*time
``````

### Write a function to calculate the displacement of an object with initial velocity u, time t and acceleration a

``````def cal_displacement(initial_velocity:float,accelration:float,time:float)->float:
return initial_velocity*time + .5*accelration*(time)**2
``````

### Write a function to calculate amount of radioactive element left based on initial amount and half life

``````def cal_half_life(initail_quatity:float, time_elapsed:float, half_life:float)->float:
return initail_quatity*((1/2)**(time_elapsed/half_life))
``````

### Write a function to calculate the new selling price based on discount percentage

``````def cal_sp_after_discount(sp:float,discount:float)->float:
return sp*(1 - discount/100)
``````

### Write a function to calculate the simple interest for principal p, rate r and time in years y

``````def get_si(p:float, r:float, t:float)->float:
return (p*r*t)/100
``````

### Write a function to calculate the compound interest for principal p, rate r and time in years y

``````def get_ci(p:float, r:float, t:float, n:float)->float:
return round(p*((1+(r/(n*100)))**(n*t)) - p,2)
``````

### Write a function to calculate the energy released by converting mass m in kg to energy

``````def cal_energy_by_mass(mass:float)->float:
c = 300000
return mass * (c**2)
``````

### Write a function to calculate the kinetic energy of an object of mass m and velocity v

``````def cal_ke(mass:float,velocity:float)->float:
return (mass*(velocity)**2)/2
``````

### Write a function to calculate the potential energy of an object of mass m at height h

``````def cal_pe(mass:float,height:float)->float:
g = 9.8
return (mass*g*height)
``````

### Write a function to calculate the electrostatic force between two charged particles with charge q1 and q2 at a distance d apart

``````def cal_electrostatic_force(q1,q2,d):
k = 9*(10**9)
return (k*q1*q2)/(d**2)
``````

### Write a function to calculate the density given mass and volume

``````def cal_density(mass,volume):
return (mass/volume)
``````