Python Forum
I need help with floats and int
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with floats and int
#4
(Aug-25-2017, 04:20 PM)ichabod801 Wrote: In the future, please put your code in python tags, see the BBCode link in my signature below. Also, it helps a lot if you give us the full text of the error you are getting.

In this case, you are trying to add a float to a string on the last line, which you can't do. You need to convert cost to a string. The easiest way to do this is with str(cost)

If you have been taught the format method of strings, you should review that. It will give you more control over how the output is formatted.

Thank you so much. We have not been taught much to be honest.
Reply


Messages In This Thread
I need help with floats and int - by calloflegend11 - Aug-25-2017, 03:16 PM
RE: I need help with floats and int - by nilamo - Aug-25-2017, 04:18 PM
RE: I need help with floats and int - by ichabod801 - Aug-25-2017, 04:20 PM
RE: I need help with floats and int - by calloflegend11 - Aug-26-2017, 03:13 AM
RE: I need help with floats and int - by BerlingSwe - Aug-27-2017, 10:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Round off floats in a list nagymusic 10 4,801 Apr-02-2019, 12:43 AM
Last Post: nagymusic
  def functions and floats alwillia 3 4,449 May-26-2018, 07:31 PM
Last Post: buran

Forum Jump:

User Panel Messages

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