Adjust the Message
00:00
The next adjustment is the 40 that it’s just written in the string and it’s not the actual product calculated. So you could now define a new variable named product and then call calc.area() there.
00:13
But what you can also do is just calculate it inside of the string. You adjust the f-string with The area of a {length}-by-{width} rectangle is and then inside curly braces you call calc.area().
00:29
And then there you add in width and length. Now, since I have a big font size here, the line is very long, and you can see that it scrolls to the right, but there should be a closing parenthesis, a curly brace, and then the quote at the end.
00:48 So make sure that your string looks like this.
00:52 I will jump to the left again, save the file, and then run the file to check if I didn’t make any mistakes.
01:02 So far it looks good because it says the area of a five by eight rectangle is 40. That looks very similar to the message before. So let’s just test this string by using a different width, for example.
01:16
So let’s use width = 6. Save it, and now the string should update perfectly. The area of a 5-by-6 rectangle is 30. That’s how it should be.
01:29 So that means that the message now is dynamic, and you can change the width back to eight.
01:38 And that means the only thing that is left missing in this challenge is to actually shout the message.
Become a Member to join the conversation.
