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

Trending Topics

Online now

Members online
979
Guests online
4,513
Total visitors
5,492

Forum statistics

Threads
2,304,683
Posts
29,161,437
Members
1,195,968
Latest member
RISE_DiGitaL_Studios
Back
Top