Python Forum
Adding second message to simple loop error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding second message to simple loop error
#1
Hello there,

hope I'm posting correctly this time.

So the loop works nicely for the first statement, but I'm getting a syntax error for the second one (ending\n)

This is what the console says:
Error:
SyntaxError: invalid syntax


magicians=["alice", "david","carolina"]
for magician in magicians:
    print(magician.title() + ", that was a great trick!"
    print("I can't wait to see your next trick," + magician.title() + ".\n")
As always, many thanks, you guys are great!
Reply
#2
Missed ')'
print(magician.title() + ", that was a great trick!")
Reply
#3
Omg, I feel like such an idiot Doh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 932 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Another Error message. the_jl_zone 2 942 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Help adding a loop inside a loop Extra 31 4,333 Oct-23-2022, 12:16 AM
Last Post: Extra
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,675 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,856 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Error message pybits 1 35,947 May-29-2021, 10:26 AM
Last Post: snippsat
  Seemingly simple loop Weber585 7 3,436 Mar-21-2021, 07:19 PM
Last Post: jefsummers
  f-string error message not understood Skaperen 4 3,267 Mar-16-2021, 07:59 PM
Last Post: Skaperen
  Simple Variable Saving in Loop DevDev 3 2,960 Mar-09-2021, 07:17 PM
Last Post: Fre3k
  Overwhelmed with error message using pandas drop() EmmaRaponi 1 2,300 Feb-18-2021, 07:31 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020