FAQ: Learn Python: Syntax - Exponents

This community-built FAQ covers the “Exponents” exercise from the lesson “Learn Python: Syntax”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Exponents

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

6 posts were split to a new topic: How many squares for 6 people who want 6 quilts of 6x6 squares?

2 posts were split to a new topic: What is 2 to the 10th power?

3 posts were split to a new topic: Do spaces in python expressions do anything?

10 posts were merged into an existing topic: How many squares for 6 people who want 6 quilts of 6x6 squares?

7 posts were split to a new topic: Troubleshooting math with strings

4 posts were split to a new topic: The math of exponent expressions

Line 4 was intentionally left blank. Was there a purpose for this? Could this program have been written without skipping line 4?

print(6 ** 2)
print(7 ** 2)
print(8 ** 2)

print(6 ** 4)

Yes it could. The blank line has no meaning to the interpreter, unlike how important indentation is.

Not sure why my solution is not a valid answer?

print(f"Number of squares needed for an 6x6 Square Quilt: {6**2}")
# 7x7 quilt
print(f"Number of squares needed for an 7x7 Square Quilt: {7**2}")
# 8x8 quilt
print(f"Number of squares needed for an 8x8 Square Quilt: {8**2}")

Answer:
Number of squares needed for an 6x6 Square Quilt: 36
Number of squares needed for an 7x7 Square Quilt: 49
Number of squares needed for an 8x8 Square Quilt: 64

Still saying the below:

Did you print 6 squared, 7 squared, and 8 squared?

I learnt about f-strings from the previous exercise’s forum section.

The exercise does not ask for the text in one’s answer, only the values. No f-string, either. Just the values.

2 Likes

someone tell me 6**6 means 36 but answer was horribly something else …
someone explain me this exercise please

1 Like

yeah same happened to me what does it means am i wrong or something which i am not getting ???

I think the issue there is that 6 x 6 = 36. This is equivalent to 6-squared (62) which could be written as 6**2 which is then equivalent to 6 * 6.

6**6 would be six to the power of six which is (6 * 6 * 6 * 6 * 6 * 6).

The * symbol is multiplication and ** is exponentiation.

1 Like

Can someone explain to me why it was (6 ** 4) instead of something like (36 * 6) because if 6 people wanted a 6x6 that would be 36 for each person and that would allow each one of them to get a 6x6

It is six people who each want six quilts. That will be 36 quilts in all. Each quilt has 36 squares, so there will be 36 * 36 squares.

  36    *   36
(6 * 6) * (6 * 6) 
6 ** 2  *  6 ** 2

By exponent law,

a ** m * a ** n == a ** (m + n)

so,

6 ** (2 + 2)  =>  6 ** 4
3 Likes

Why exactly does it turn into 36 * 36 ?
I’m sorry if i’m a bother but this is something I want to learn and understand so I appreciate you helping me out :smiley: <3

Six people times six quilts each is thirty six quilts. Each quilt is six squares long and six squares wide. That means thirty-six squares per quilt.

 36 quilts times 36 squares each is 36 * 36 squares in all
3 Likes

Thank you for explaining you’ve been a big help :smiley:

1 Like

yeahhh thats the thing i feel thanks