Question on LTHW Python 3 Study Drills (EX 16, 19, 22)

I have a question on Exercise 16, 19, and 22 in Learn Python 3 the Hard Way.

In Exercise 16, Study Drill Question 3, apparently I have to shorten line1, line2, and line3? Can someone show me how?

In Exercise 19, Study Drill Question 3, im supposed to write a function “10 different ways”, is it like cheese_and_crackers(5 + 1, 6-2) count as 1 way and cheese_and_crackers(6/2, 3*4) another way?

In Exercise 22, Im supposed to write down every symbol and function I see, i thought it would be cool if i saw others in case i missed anything?

On ex16:
It worked for me to merge
line1 = …
line2 = …
line3 = …

into
lines = line1 + “\n”+ line2 + “\n”+ line3 +"\n"

and then
target.write(lines)

1 Like

Yep, that’s one way. Also remember you do f-strings too right? So you can put a string inside a string with that:

x = "hi"
y = "joe"
greet = f"{x} {y}"

Note, this was:

x = "hi"
y = "joe"
greet = f"{hi} {joe}"

Which is the error we’re talking about below.

1 Like

errr … isn’t it
greet = f"{x} {y}"
? :wink:

f string looks better, indeed, thanks.

Haha! Yeah, I did Python’s job for it.