Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
dear god PLEASE HELP!?! (python)
[b][red]This message was edited by streak118 at 2006-5-1 0:1:14[/red][/b][hr]
ok... Im a tard... somebody, ANYBODY!, please help! tell me what I'm doing wrong? or better yet tell me what to fix and how to? this is a class project. I'm failing this class because Im not grasping programming... and I started with C++ then came to this, HELP!?! #This
program will calculate the time it will take a sound to travel based on #the
matter it is traveling through; air, water, or steel.
def main(): #declare
and initialize variables #AIR
AIR = 1100 #WATER
WATER = 4900 #STEEL
STEEL = 16400 #MenuChoice
MenuChoice = " " #feet
as int #feet
= 0 #seconds
seconds = 0 #Intro
print "WELCOME TO THE SPEED OF SOUND PROGRAM!!!"
print "I will calculate the time it takes for a souond to travel through"
print "different matter." #build
menu for user to choose from
print "Please choose from the following menu:
print " A) Air"
print " W) Water"
print " S) Steel" #prompt
user for MenuChoice
MenuChoice = raw_input("
Please enter your choice here: ") #prompt
user for distance of travel
feet = input("Now, please enter the distance that the sound wave will travel(feet): ") #calculate
time for sound to travel
A = AIR
W = WATER
S = STEEL
if MenuChoice == A:
seconds = feet / AIR
elif MenuChoice == W:
seconds = feet / WATER
MenuChoice == S
seconds = feet / STEEL #display
ETA of the sound
It will take", seconds, "second(s) for the sound wave to travel."
ps... I have this indented but it's not showing up on the message board.
0 · ·