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!

1 Like

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.

1 Like