Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to add values to a list in python

fruits = ["Apple", "Banana"]

# 1. append()
print(f'Current Fruits List {fruits}')

f = input("Please enter a fruit name:
")
fruits.append(f)

print(f'Updated Fruits List {fruits}')
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #add #values #list #python
ADD COMMENT
Topic
Name
2+8 =