-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q02.py
31 lines (22 loc) · 986 Bytes
/
Q02.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Aledutron
SPPU 2019 FE PPS Lab
SPPU First Year (FE) Programming and Problem Solving (PPS) Lab Assignments (2019 Pattern)
Youtube PPS Playlist Link: https://youtube.com/playlist?list=PLlShVH4JA0osTzddxh-2s1yaigpyp6DRx&si=5RWSN_MmtX1FACb1
Problem Statement:
Q2
To accept an object mass in kilograms and velocity in meters per second and display its momentum. Momentum is calculated as e=mc2 where m is the mass of the object and c is its velocity.
Explaination Video Link: https://www.youtube.com/watch?v=5biTgAF1hcc&list=PLlShVH4JA0osTzddxh-2s1yaigpyp6DRx&index=3&pp=iAQB
"""
# Setup Code
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
###########################################
# Real Code Starts
mass = float(input("Enter mass: "))
velocity = float(input("Enter velocity: "))
# momentum = mass * velocity * velocity
momentum = mass * (velocity**2)
print(
f"Momentum of mass {mass}kg and velocity {velocity}m/s is {momentum}kgm/s")