Python Forum
Any way to get raw_input to work in my function?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any way to get raw_input to work in my function?
#5
I got it to work! Here's my new code for anyone who might have come across a similar problem.

 def food_waste(cold_food, hot_food):
    print "Based on the data given, your total Cold Waste is %d pounds." %cold_food
    print "Data also shows that Hot Waste accumulated to %d pounds." %hot_food
    print "The total amount of food wasted today was %d pounds." %(hot_food + cold_food)


pounds_of_cold = int(raw_input("Enter > "))
pounds_of_hot = int(raw_input("Enter > "))

food_waste(pounds_of_cold, pounds_of_hot)

#Program to calculate food waste, It works! 

Sorry, I thought I was using my script tags correctly... I was trying to delete the post and repost correctly but I see no way to...
Reply


Messages In This Thread
RE: Any way to get raw_input to work in my function? - by Pythonerous - Oct-27-2016, 05:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  print doesnt work in a function ony 2 403 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  I dont know why my function won't work? MehHz2526 3 1,296 Nov-28-2022, 09:32 PM
Last Post: deanhystad
  time function does not work tester_V 4 3,179 Oct-17-2021, 05:48 PM
Last Post: tester_V
  write new function or change the old one to work "smartter? korenron 3 2,070 Aug-09-2021, 10:36 AM
Last Post: jamesaarr
  string function doesn't work in script ClockPillow 3 2,504 Jul-13-2021, 02:47 PM
Last Post: deanhystad
  Why does unpickling only work ouside of a function? pjfarley3 5 3,553 Dec-24-2020, 08:31 AM
Last Post: pjfarley3
  Going thru tutorials..."NameError: name 'raw_input' is not defined" hmonnier 4 4,343 Jul-14-2020, 02:19 PM
Last Post: BitPythoner
  len() function, numbers doesn't work with Geany Editor Penguin827 3 3,087 May-08-2020, 04:08 AM
Last Post: buran
  Powerset function alternative does not work oClaerbout 1 2,048 Feb-11-2020, 11:34 AM
Last Post: Larz60+
  why my function doesn't work cimerio 4 3,004 Jan-20-2020, 08:11 PM
Last Post: cimerio

Forum Jump:

User Panel Messages

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