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?
#1
Hi again! Been playing around with functions and decided to make my own and wanted to make a program that stated food waste in pounds with the data coming from the user but I'm having trouble getting my formatters to be seen as numbers from the users and not a string as it states. Here's the code I wrote.
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

food_waste(raw_input("Place Cold Food Waste In Pounds Here. > "), raw_input("Place Hot Food Waste In Pounds Here. > "))
This is as far as I got before I was reciving an error. Any help would be appreciated :)

Thanks,
Pythonerous
Reply


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

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