Python Forum
Cannot figure out what is wrong
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot figure out what is wrong
#1

Alright so here's the issue, I cannot figure out why this will not work. I have tried everything. No error pops up when I run it. I even tried placing a print statement on the first line just to see if that would pop up, and it did not. The console was just blank.
The program is supposed to find out an inputted weight and determine how much you'd weigh on another planet.

#Asks planet to be calculated
def ask_planet():
    planet = input("Which planet would you like to know your weight for? ")

#Asks for weight of user
def ask_weight():
    lbs = float(input("How many pounds do you weigh? "))

#Asks for the weight of user if to be done again
def another_weight():
    another_weight = input("Would you like to change the calculated weight? ")
    if another_weight == "No":
        ask_planet()
    elif another_weight == "Yes":
        ask_weight()
        ask_planet()
    else:
        print "That's not a verified command, please enter yes or no."
        another_weight()

#To be used for restarting for another planet
def another_planet():
    another_time = input("Would you like to know your weight on another planet? ")
    if another_time == "No":
        break
    elif another_time == "Yes":
        another_weight()
    else:
        print "That's not a verified command, please enter yes or no."
        another_planet()

def calculation():
    mass = lbs/9.807
    mercury = mass*3.7
    venus = mass*8.87
    mars = mass*3.71
    jupiter = mass*24.92
    saturn = mass*10.44
    uranus = mass*8.87
    neptune = mass*11.15
    pluto = mass*0.58

#Calls the planet that the user wants to know their weight on
def planet_call():
    if planet == "Mercury":
        print "Your weight on Mercury would be " + str(mercury) + " pounds."
    elif planet == "Venus":
        print "Your weight on Venus would be " + str(venus) + " pounds."
    elif planet == "Mars":
        print "Your weight on Mars would be " + str(mars) + " pounds."
    elif planet == "Jupiter":
        print "Your weight on Jupiter would be " + str(jupiter) + " pounds."
    elif planet == "Saturn":
        print "Your weight on Saturn would be " + str(saturn) + " pounds."
    elif planet == "Uranus":
        print "Your weight on Uranus would be " + str(uranus) + " pounds."
    elif planet == "Neptune":
        print "Your weight on Neptune would be " + str(neptune) + " pounds."
    elif planet == "Pluto":
        print "Your weight on Pluto would be " + str(pluto) + " pounds."
    else:
        print "That is not a verified planet."

print "This program will calculate how much you weigh on another planet."
print "The weight asked will be in pounds."
print "Available planets are: Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, and Pluto"
ask_weight()
ask_planet()
calculation()
planet_call()
another_planet()
Reply


Messages In This Thread
Cannot figure out what is wrong - by Korbrent - Dec-11-2017, 09:13 PM
RE: Cannot figure out what is wrong - by j.crater - Dec-11-2017, 09:33 PM
RE: Cannot figure out what is wrong - by Korbrent - Dec-11-2017, 09:39 PM
RE: Cannot figure out what is wrong - by squenson - Dec-11-2017, 09:35 PM
RE: Cannot figure out what is wrong - by squenson - Dec-11-2017, 10:14 PM
RE: Cannot figure out what is wrong - by wavic - Dec-11-2017, 11:12 PM
RE: Cannot figure out what is wrong - by Korbrent - Dec-12-2017, 12:00 AM
RE: Cannot figure out what is wrong - by wavic - Dec-12-2017, 12:12 AM
RE: Cannot figure out what is wrong - by Korbrent - Dec-12-2017, 12:17 AM
RE: Cannot figure out what is wrong - by Korbrent - Dec-12-2017, 01:31 AM
RE: Cannot figure out what is wrong - by wavic - Dec-12-2017, 03:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Im so stressed because I cant figure out what I'm doing wrong. BursteXO 2 3,029 Jan-29-2018, 01:16 AM
Last Post: BursteXO

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020