Sure, here's an example Python program that allows the user to enter their name, age, and the category they would like to work in as a volunteer at Cornerstone Hospital. The program also saves the data in arrays for later access:
# Initialize empty arrays for name, age, and category data
name_data = []
age_data = []
category_data = []
# Define function to get user input for name, age, and category
def get_user_input():
name = input("Enter your name: ")
age = input("Enter your age: ")
category = input("Enter the category you would like to work in (1. State, 2. Pharmacy, 3. Toilets, 4. Maternity): ")
return name, age, category
# Define function to display the categories
def display_categories():
print("Categories: ")
print("1. State")
print("2. Pharmacy")
print("3. Toilets")
print("4. Maternity")
# Get user input and append to data arrays
name, age, category = get_user_input()
name_data.append(name)
age_data.append(age)
category_data.append(category)
# Display categories and user input
display_categories()
print("Name: ", name_data[0])
print("Age: ", age_data[0])
print("Category: ", category_data[0])
This program initializes empty arrays for name, age, and category data. It then defines a function get_user_input() that prompts the user to enter their name, age, and the category they would like to work in. Another function display_categories() displays the categories for the user to choose from.
The program then gets user input using get_user_input() and appends the input to the data arrays. Finally, the program displays the categories and the user input using display_categories() and array indexing.
Note that this is just an example program and can be modified to suit your specific needs.