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
#12
(Dec-12-2017, 01:27 AM)sparkz_alot Wrote: return is a value. in order to use it you need to assign it to a variable:
def ask_weight():
    lbs = float(input("How many pounds do you weigh? "))
    return lbs
weight = ask_weight()
print str(weight)
If you are using Python 2.x as was suggested, you should be using 'raw_input' rather than 'input'.

Alright, you are going to hate me for this... First of all, I do have an idea of return functions, I just am not able to realize a difference between them and prints. Secondly, I found out the reason why nothing popped up was because of line 39 and this wonderful command called break. As it was defining my functions, I think it read break as a cue to stop defining and to end the program. The second I removed the break command, it started working.

Thank you for teaching me so much though (especially the format command, that will be a life saver in the future.)
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,109 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