Velocity of object Generator (#421)

* Velocity of object

* Latex formatting for velocity_of_object

---------

Co-authored-by: Luke Weiler <lukew25073@gmail.com>
This commit is contained in:
xenium
2023-06-02 19:58:14 +05:30
committed by GitHub
parent c18a873046
commit c6ddbbade9
2 changed files with 19 additions and 0 deletions

View File

@@ -131,4 +131,5 @@ gen_list = [
("area_of_trapezoid", "geometry"),
("tribonacci_series", "computer_science"),
("nth_tribonacci_number", "computer_science"),
("velocity_of_object","misc"),
]

View File

@@ -572,3 +572,21 @@ def surds_comparison(max_value=100, max_root=10):
problem = rf"Fill in the blanks ${radicand1}^{{\frac{{1}}{{{degree1}}}}}$ _ ${radicand2}^{{\frac{{1}}{{{degree2}}}}}$"
return problem, f'${solution}$'
def velocity_of_object(max_displacement=1000,max_time=100):
"""Velocity of object
| Ex. Problem | Ex. Solution |
| --- | --- |
| An object travels at uniform velocity a distance of $100 m$ in $4$ seconds. What is the velocity of the car? | $25 m/s$ |
"""
displacement = random.randint(1,max_displacement)
time_taken = random.randint(1, max_time)
velocity = "${} m/s$".format(round(displacement/time_taken, 2))
problem = f"An object travels at uniform velocity a distance of ${displacement} m$ in ${time_taken}$ seconds. What is the velocity of the car? "
return problem , velocity