Learn Courses My Dashboard

Lesson 7-14 day challenge

is anyone else stuck on the challenge text for lesson 7? I am and I could use of guidance please. This is what I have so far…and I’m stuck. Idk.

func printTotalWithTax(subtotal:Double){
    
    print("subtotal")
}
printTotalWithTax(subtotal: 1.13)

This is challenge 2 but will probably need help in all challenges in Lesson 7.

Hi @osvaldotl ,

You are on the right track.
Inside your function you should use the parameter subtotal, which could be any number and multiply that with 1.13.
At the moment you are printing a String “subtotal” and not the value stored in subtotal.
Hope it helps! :smiley:

func printTotalWithTax(subtotal:Double){
    
    print("subtotal * 1.13")
}

printTotalWithTax(subtotal: 0)

Is this correct?

I figured the first issue… it was the “” that messed it up, correct?
Also can you or someone check if challenge 3 of Lesson 7 is correct plz


**func** getTotalWithTax(subtotal:Double) -> Double{

**return** subtotal * 1.13

}

getTotalWithTax(subtotal: 5)

Thanks! Want to make sure im on the right track!

Hi @osvaldotl

Congratulations for figuring it on your own! :blush:

About your second question, yes! you are on the right track! You can also post the Challenge 4 inquiries here for the Lesson 7 if you want.

Happy coding!

1 Like

Sorry for my late response. I guess I’m in a different time zone.

You are on the right track and making progress.
Isn’t it rewarding when the output is what you wanted :smiley:

Keep it up!

2 Likes

Yeah I’m really struggling with the Lesson 7 Challenge. I found the previous 6 lessons had a gentle learning incline but 7 was a far more vertical trajectory :grinning_face_with_smiling_eyes:

I’ve been going over the challenges for 2 days trying to work out how to do them, and feel so stupid that I just can’t get them. I’ve now referenced the solutions guide and replicated them, but I hope this isn’t the moment where I get lost and give up. I plan to move onto the paid programs afterwards because I really want to learn this thing!

Don’t worry if you have to reference the solutions.

I’m pretty new at this, too, and I’ve struggled from time to time just understanding the challenge and, if I can’t figure out what’s being asked, I have gone to the solution.

In these situations, I print out the solution, and the challenge, and then compare the step(s) I’m struggling with with the relevant part of the solution code.

Once I better understand what is being asked, I put aside the solution and go back to Xcode and then rewrite what I’ve just figured out (often in a slightly different way). That way it sticks in my head. Then I continue with the challenge.

However you do it, it will take time to stick in your head. I’m often referring back to previous lessons to remind myself of what we’ve already covered. I feel that what we’re learning isn’t necessarily as important as learning how to learn.

My past experience has taught me that “figuring things out”, no matter how you figure them out, is at least as important as the code itself. The code is transitory, but learning how to “figure things out” lasts forever.

1 Like

I really appreciate your reply @JRudderham; I feel better as well for reading through how you process and learn it as well, to be able to get another perspective. I guess referring to the solutions when I get stuck are just the same as being in a class with a teacher who shows you what to do, let’s you have a crack, and if you get stuck they run through it again so you can put the missing pieces together. Hmmm. You make a great point about ‘figuring things out’. Cheers and thanks again :slight_smile:

1 Like