Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

def main(): Mb = input(\"enter the mass of the bike \") Mb = int(Mb) V = input(\

ID: 3543275 • Letter: D

Question

def main():

Mb = input("enter the mass of the bike ")

Mb = int(Mb)

V = input("enter the velocity ")

V = float(V)

cfdraft = input("enter cf draft ")

cfdraft = float(cfdraft)

for M in range(64,90,4):

c = powerpersecond(M,Mb,V,cfdraft)

print(c)

def powerpersecond(M,Mb,V,cfdraft):

g = (9.8)

k = (.18)

cr = (.001)

pair = ( k * cfdraft * (V ** 3))

proll = ( cr * g * ( M + Mb ) * V )

psec = ( pair + proll )

return psec

im having trouble putting this into a .txt file

add additional functionality to your code to write your data out to a txt file. The file should be called BikeOutput.txt. Each row in the file should contain rider mass, bike mass, velocity, coefficient of drafting, and the power per second calculation

Explanation / Answer

SAMPLE RUN:

INPUT GIVEN

enter the mass of the bike 3
enter the velocity 4
enter cf draft 5


OUTPUT FILE : OUTPUT.TXT

64 3 4.0 60.2264
68 3 4.0 60.3832
72 3 4.0 60.54
76 3 4.0 60.6968
80 3 4.0 60.8536
84 3 4.0 61.0104
88 3 4.0 61.1672