Python Forum

Full Version: Help request for loop example
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can anyone help please i'm probably off track

# Make a list called mates, containing the names Margot, Kathryn and Prisila
# code the for loop using the variable friends.
# set another variable invitation so that when printed it outputs Hi friend(variable). Please come to my party on Saturday!

mates = ["Margot", "Kathryn", "Prisila"]
    
for friend in mates:   
    print(friend)         

print("Hi"(friend)"please come to the party")
You are not off track. You need to select your code when you post and click the code button (blue/yellow snake) so that we can see your indentation.

Other than that your code should work except for your 2nd print statement. Look up string formatting and print variables.

Post back if you're still stuck...