 <p>You have several problems with your code. The simple things first:</p> <ul> <li><code>starting_Month</code> and <code>starting_Day</code>. Caps only belong in class names, e.g. <code>class MyClass:</code>.</li> <li><code>datetime</code> has a <code>.date()</code> function that returns just the date.</li> <li><p>string formatting is <em>way</em> nicer than concatenation. Compare:</p> <pre><code>'{}-{}-{}'.format(year, starting_month, starting_day) </code></pre> <p>to what you have.</p></li> <li>You <em>have</em> the answer commented out - <code>print((d1-d2).days * 24 * 60)</code>. Just change that up: <code>print((date1-date2).days)</code></li> <li><p>You could actually just use math here:</p> <pre><code>pills_left = initial_pill_count - (daily_intake * number_of_days) </code></pre></li> </ul> <p>Putting this all together, here's how you should have written this:</p> <pre><code>from datetime import datetime # Just convert to int when you get the input. Also, only one space # before input. leftover_pill_count = int(input('How many pills do you have left? ')) new_pill_count = int(input('How many pills did you get? ')) daily_pill_intake = int(input('How many pills do you take every day? ')) # And one space before input! start_date = input('Starting date (YYYY-MM-DD): ') end_date = input('End date (YYYY-MM-DD): ') # Using the same format multiple places? Use a variable! # that way you only have to change it once :) date_fmt = '%Y-%m-%d' start_date = datetime.strptime(start_date, date_fmt) end_date = datetime.strptime(end_date, date_fmt) # `end-start`, always. Or you could use `abs(start-end)`, # but don't do that. total_days = (end_date-start_date).days initial_pill_count = leftover_pill_count + new_pill_count # Here's how the loop *should* look loop_pills_left = initial_pill_count for i in range(total_days): loop_pills_left -= daily_pill_intake print(loop_pills_left) # Or you could approach it mathematically! math_end_count = initial_pill_count - (daily_pill_intake * total_days) # Let's just make sure that both approaches get us the same answer, though assert math_end_count == loop_pills_left, 'If this fails, we got our math wrong' pills_left = loop_pills_left # String formatting is *much* nicer than concatenation. print('Taking {} pills per day you should have {} pills left.' .format(daily_pill_intake, pills_left)) </code></pre>