We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,617 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

help in question

Write a Python program to apply the given formulae above to complete the
missing information in Table 2.2. As vMax (his speed at 30,000m) is an unknown,
allow the user to input a value of between 500m/s and 600m/s, each time
displaying a new completed table. For an extra 3 marks, force the user to enter a
value between 500 and 600 m/s.
Output the table in columns with all numbers aligned right and all decimal points
lined up. Because of the importance of accuracy, calculate all results to 3
decimal places

hi can anyone help me in putting the results i get out of the loop into a table and also
i want to know how to limit the value of Vmax of the first input to values 500-600 but when asked to enter Vmax the second time i want no restrictions. any ideas on how to do so. fyi this is python.

c=0
while True: 
    c=c+1
    Vmax= float(input("enter Value for max speed: ",))# this will ask user to enter any value for Vmax
    if Vmax >= 500 and Vmax <=600:
        break
    Vmax= float(input("enter Value for max speed: ",))
    Vmin= float(input("enter Value for min speed: ",))#this will ask user to enter any value for Vmin
    dt= float(input("enter the distance travelled: ",))#this will ask user to enter any value for distance travelled
    Va=((Vmax + Vmin)/2) # this is the equation which is used to find average speed
    t=dt/Va #this equation determines time taken
    print("t     |  Va")
    print ("%4.3f | %6.3f"%(t, Va))
    if c==3:
2
Contributors
1
Reply
19 Hours
Discussion Span
5 Months Ago
Last Updated
2
Views
z.n11
Newbie Poster
1 post since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
if c==3:

if can not exist without statements, if you want to use place holder use pass

if c==3:
    pass
pyTony
pyMod
Moderator
6,331 posts since Apr 2010
Reputation Points: 879
Solved Threads: 990
Skill Endorsements: 27

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0680 seconds using 2.69MB