-1

I'm writing a code in Python IDLE 3.6 that prints out a user's name in their own choice of style and colour and everything is working fine apart from this. Somehow it won't print out the three highlighted lines underneath each other and I've tried multiple methods but they all keep ending up with unexpected character after line continuation character. Please help?

if style == ":":
        if colour == "Red" or "red":
            cat.write(( ":" * (len(name) + 4)), "stderr")
            cat.write((":", name, ":"), "stderr")
            cat.write((":" * (len(name) + 4)), "stderr")
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
Hana
  • 1
  • 2
  • 3
    I do not understand what you're trying to achieve, but `if colour == "Red" or "red"` will always evaluate to True. If you want to check if colour is Red or red, use `if colour.lower() == "red"` or `if colour == "Red" or colour == "red"` – Gsk Mar 14 '18 at 21:01
  • paste the stack trace of error please – Saher Ahwal Mar 14 '18 at 21:11

1 Answers1

0

I'm not sure exactly what class you're using (what is cat?), but presumably you need to add newline characters ('\n') to each cat.write(...) call.

tonysdg
  • 1,335
  • 11
  • 32