Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
learning to code python
#2
Your code is printing out both the date and the total calories in the final line, but with no space between them (since you haven't indicated one in the code). There are tons of different ways of formatting print output and strings in python, but a simple change to your code to add a colon and space after the date would look like:
print("Calories content for " + str(today) + ': ' + str(totalcal))
Reply


Messages In This Thread
learning to code python - by nhan - May-23-2020, 01:25 PM
RE: learning to code python - by GOTO10 - May-23-2020, 02:19 PM
RE: learning to code python - by Dotparsed - May-23-2020, 02:21 PM
RE: learning to code python - by nhan - May-23-2020, 02:30 PM
RE: learning to code python - by jefsummers - May-23-2020, 03:15 PM
RE: learning to code python - by nhan - May-23-2020, 03:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad I'm stuck with the reinforcement learning function in my Code OskiLori 2 1,608 May-20-2023, 10:01 PM
Last Post: OskiLori
  Translation of R Code to Python for Statistical Learning Course SterlingAesir 2 2,155 Aug-27-2020, 08:46 AM
Last Post: ndc85430
  Learning python, stuck on some code. stanceworksv8 2 3,521 Apr-02-2019, 01:51 AM
Last Post: stanceworksv8
  Still learning - code efficiency, which of these is better? shelzmike 2 3,304 Oct-14-2017, 04:47 AM
Last Post: shelzmike

Forum Jump:

User Panel Messages

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