❓ 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
  • 292
    Views
  • 1
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
381
Guests online
1,370
Total visitors
1,751

Forum statistics

Threads
2,292,309
Posts
29,075,999
Members
1,210,276
Latest member
yezzurskie22
Back
Top