Hi guys,
I just started learning to code and using Python, I am working on a beginner exercise and the result is not what I am supposed to get, I am hoping you guys could point me in the right direction on how to correct it. I didn't get any error, but the last print line only printed out the the string "Calories content for and the date" but it does not print out the number of totalcal.
When I removed the str(today) from that line, it printed out the totalcal. If both str(today) + str(totalcal) are on the same line, then it would only printed out the value for str(today), so it would only be one or the other. What am I doing wrong? Thank you so much for your help, please let me know if you have any questions.
I just started learning to code and using Python, I am working on a beginner exercise and the result is not what I am supposed to get, I am hoping you guys could point me in the right direction on how to correct it. I didn't get any error, but the last print line only printed out the the string "Calories content for and the date" but it does not print out the number of totalcal.
When I removed the str(today) from that line, it printed out the totalcal. If both str(today) + str(totalcal) are on the same line, then it would only printed out the value for str(today), so it would only be one or the other. What am I doing wrong? Thank you so much for your help, please let me know if you have any questions.
from datetime import date today = date.today() print("Today's date? " + str(today)) print("Breakfast Calories? ") breakfast_cal = int(input()) print("Lunch Calories? ") lunch_cal = int(input()) print("Dinner Calories? ") dinner_cal = int(input()) print("Snack Calories? ") snack_cal = int(input()) totalcal = breakfast_cal + lunch_cal + dinner_cal + snack_cal print(totalcal) print("Calories content for " + str(today) + str(totalcal) )