❓ Help List and Tuples Python Code

PHC-kT

Elite
Create a program that asks the user for his birthday in the format "Date-Month-Year"

example: "You were born in January"


1. Create a program with a predefined list of people. Ask the user for his name, add it to the end of the list and print the updated list
 
Sure! Here's a program that asks the user for their name, adds it to a predefined list of people, and then prints the updated list:

Python:
people = ["Alice", "Bob", "Charlie"]

# Ask the user for their name
name = input("Enter your name: ")

# Add the user's name to the list
people.append(name)

# Print the updated list
print("Updated list of people:", people)

When you run this program, it will prompt you to enter your name. After you enter your name and press Enter, it will add your name to the people list and print the updated list.

Note: In this example, the predefined list of people is ["Alice", "Bob", "Charlie"], but you can modify it to include any names you want.
 

Similar threads

About this Thread

  • 1
    Replies
  • 309
    Views
  • 1
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
1,063
Guests online
1,533
Total visitors
2,596

Forum statistics

Threads
2,315,586
Posts
29,183,130
Members
1,182,640
Latest member
re322
Back
Top