# First time homework help using 2.75

Printable View

• 06-11-2013, 02:56 AM
lunapt
First time homework help using 2.75
using 2.75
Homework question here: http://imgur.com/aHLYwyQ
I've just started learning python so i'm really lost...
Do I start like

x= year y= months x= 5 y= 9 print x*12 print y/12 + 11
this code is terribly, horribly, wrong, but this is my first time trying to learn python >< any help would be SO appreciated. thank you.
• 07-25-2013, 08:29 PM
JabZero
Hello lunapt,

First, there are some redundancies in your code that I suggest to delete. For instance, do not not assign unnecessary dummy variables. You assign year to x, and then 5 to x. Simply, assign 5 to year; the same goes for months.

Second, you get a wrong result because your formula is wrong. Your assignment asks you to find number of months in year(s) plus some additional months. Thus, your formula should be
Quote:

answer= 12*years + months
Here is the code for the first part of the assignment, the second part is the reverse of the first. You should be able to figure that out. If not, ask. :thumbsup:

Quote:

years = 18
months = 27
answer = years*12 + months
print years,' years and ',months,' months are equivalent to:', answer,' months'