Python Forum
Help request for loop example
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help request for loop example
#1
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")
Reply
#2
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...
"So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth!" - Tim the Enchanter
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how can I correct the Bad Request error on my curl request tomtom 8 4,969 Oct-03-2021, 06:32 AM
Last Post: tomtom
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,862 Jun-18-2020, 08:07 AM
Last Post: buran
  HTTP request inside a for loop. ayanda83 1 5,671 May-08-2017, 01:11 PM
Last Post: ayanda83

Forum Jump:

User Panel Messages

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