Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (Retired) Things That Count Things That Count

I can't figure out how to multiply int

The challenge is to create a variable for age and a second variable for days where it multiplies the age by 52 and by 7.

This is what I have-

age = int(27)

days: print(int('age')*int(52)*int(7))

days_alive.py
age = int(27)

days:
  print(int('age')*int(52)*int(7))

3 Answers

In Python, you aren't required to declare the variable type, as it is not a statically typed language. Python will figure out that:

age = 25

Means that you want to assign the integer 25 to the variable age.

With that in mind, all the question is asking you is the following:

days = age * 52 * 7

I hope that helps clarify the way Python handles variables!

On a side-note, if you ever want to find out what type your variable is, try the following:

type(age)

Will return:

<type 'int'>

This is awesome thank you! I think I was overcomplicating it unnecessarily.

[age] field should not be in quotes. Also, Not familiar with colon (:) syntax after 'days', I would calc "days = int(age), etc'' then "print(days)".

Thanks for your help, Perry!

Mustafa Bayramov
Mustafa Bayramov
4,778 Points

age is already int age = int(27) print(age*int(52)*int(7)) print(int(27)*int(52)*int(7)) print("{}".format(age*int(52)*int(7)))

Mustafa, so would the string

print("{}".format(age*int(52)*int(7)))

be the best one?