SlideShare a Scribd company logo
1/8
PROGRAM TO CREATE A LIST IN PYTHON AND
VALUES OF LIST WILL BE TAKEN AS INPUT
torchbearersnotebook.blogspot.com/2021/07/program-to-create-list-in-python-and.html
TO CREATE A LIST OF FRUITS AND TAKE FRUITS AS INPUT WRITE THE
PROGRAM GIVEN BELOW:
print("Enter fruit number 1:")
a = input()
print(a)
print("Enter fruit number 2:")
b = input()
print(b)
print("Enter fruit number 3:")
c = input()
print(c)
print("Enter fruit number 4:")
d = input()
print(d)
print("Enter fruit number 5:")
e = input()
print(e)
print("Enter fruit number 6:")
f = input()
print(f)
2/8
PROGRAM TO ADD AN ELEMENT AT THE END OF A LIST:
print("Enter fruit number 1:")
a = input()
print(a)
print("Enter fruit number 2:")
b = input()
print(b)
print("Enter fruit number 3:")
c = input()
print(c)
print("Enter fruit number 4:")
d = input()
print(d)
print("Enter fruit number 5:")
e = input()
3/8
print(e)
print("Enter fruit number 6:")
f = input()
print(f)
print("Enter fruit number 7:")
g = input()
print(g)
myfruitlist=[a, b, c, d, e, f]
print(myfruitlist)
myfruitlist.append(g)
print(myfruitlist)
PROGRAM TO ADD AN ELEMENT AT A PARTICULAR INDEXING OF A LIST:
print("Enter fruit number 1:")
a = input()
print(a)
print("Enter fruit number 2:")
b = input()
print(b)
print("Enter fruit number 3:")
4/8
c = input()
print(c)
print("Enter fruit number 4:")
d = input()
print(d)
print("Enter fruit number 5:")
e = input()
print(e)
print("Enter fruit number 6:")
f = input()
print(f)
print("Enter fruit number 7:")
g = input()
print(g)
print("Enter fruit number 8:")
h = input()
print(h)
myfruitlist=[a, b, c, d, e, f, g]
print(myfruitlist)
myfruitlist.insert(6,h)
print(myfruitlist)
5/8
PROGRAM THAT REMOVES AND RETURNS THE LAST VALUE FROM THE
GIVEN LIST OR THE GIVEN INDEX:
print("Enter fruit number 1:")
a = input()
print(a)
print("Enter fruit number 2:")
b = input()
print(b)
print("Enter fruit number 3:")
c = input()
print(c)
print("Enter fruit number 4:")
d = input()
print(d)
print("Enter fruit number 5:")
e = input()
print(e)
print("Enter fruit number 6:")
f = input()
6/8
print(f)
print("Enter fruit number 7:")
g = input()
print(g)
print("Enter fruit number 8:")
h = input()
print(h)
myfruitlist=[a, b, c, d, e, f, g, h]
print(myfruitlist)
myfruitlist.pop()
print(myfruitlist)
PROGRAM THAT REMOVES A PARTICULAR ELEMENT FROM YOUR LIST:
print("Enter fruit number 1:")
a = input()
print(a)
print("Enter fruit number 2:")
7/8
b = input()
print(b)
print("Enter fruit number 3:")
c = input()
print(c)
print("Enter fruit number 4:")
d = input()
print(d)
print("Enter fruit number 5:")
e = input()
print(e)
print("Enter fruit number 6:")
f = input()
print(f)
print("Enter fruit number 7:")
g = input()
print(g)
print("Enter fruit number 8:")
h = input()
print(h)
myfruitlist=[a, b, c, d, e, f, g, h]
print(myfruitlist)
myfruitlist.remove(b)
print(myfruitlist)
8/8

More Related Content

What's hot (20)

DOCX
8.1
namthip2539
 
PPTX
C Programming Language Part 4
Rumman Ansari
 
PDF
PyParis2017 / Incremental computation in python, by Philip Schanely
Pôle Systematic Paris-Region
 
PDF
C언어 스터디 강의자료 - 1차시
Junha Jang
 
PPTX
Python basic Program
nuripatidar
 
PDF
Applications of stack
A. S. M. Shafi
 
PDF
Stack Data Structure
Er. Ganesh Ram Suwal
 
DOCX
array implementation
Sathya Ds
 
DOCX
01 list using array
SivakamiRaja1
 
PPT
ML: A Strongly Typed Functional Language
lijx127
 
PPTX
DS- Stack ADT
MythiliMurugan3
 
DOCX
Array imp of list
Elavarasi K
 
PDF
Generators
amalagon00
 
C Programming Language Part 4
Rumman Ansari
 
PyParis2017 / Incremental computation in python, by Philip Schanely
Pôle Systematic Paris-Region
 
C언어 스터디 강의자료 - 1차시
Junha Jang
 
Python basic Program
nuripatidar
 
Applications of stack
A. S. M. Shafi
 
Stack Data Structure
Er. Ganesh Ram Suwal
 
array implementation
Sathya Ds
 
01 list using array
SivakamiRaja1
 
ML: A Strongly Typed Functional Language
lijx127
 
DS- Stack ADT
MythiliMurugan3
 
Array imp of list
Elavarasi K
 
Generators
amalagon00
 

Similar to Torchbearersnotebook.blogspot.com program to create a list in python and values of list will be taken as input (1) (20)

PPTX
list and control statement.pptx
ssuser8f0410
 
PPTX
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
PPTX
Python Collection datatypes
Adheetha O. V
 
PPTX
powerpoint 2-13.pptx
JuanPicasso7
 
PPT
PE1 Module 3.ppt
balewayalew
 
PPTX
Python programming
sirikeshava
 
PDF
GE3151_PSPP_UNIT_4_Notes
Guru Nanak Technical Institutions
 
PDF
python_lab_manual_final (1).pdf
keerthu0442
 
PPTX
ANSHUL RANA - PROGRAM FILE.pptx
jeyel85227
 
PDF
xii cs practicals
JaswinderKaurSarao
 
PPTX
Python.pptx
AshaS74
 
PPTX
This material is Phython programming Course.
Asaminew Adugna
 
PPTX
Python programming workshop session 3
Abdul Haseeb
 
PPTX
Python programming –part 3
Megha V
 
PPTX
Python for Beginners(v3)
Panimalar Engineering College
 
PPTX
The document discusses for loops in Python. It explains that for loops are us...
xuwnudbek266
 
PDF
python_avw - Unit-03.pdf
AshaWankar1
 
PPTX
Python Lists is a a evry jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...
KavineshKumarS
 
PPTX
File handling in pythan.pptx
NawalKishore38
 
PPTX
ADST university of Sussex foundation class
MarufFarhanRigan1
 
list and control statement.pptx
ssuser8f0410
 
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
Python Collection datatypes
Adheetha O. V
 
powerpoint 2-13.pptx
JuanPicasso7
 
PE1 Module 3.ppt
balewayalew
 
Python programming
sirikeshava
 
GE3151_PSPP_UNIT_4_Notes
Guru Nanak Technical Institutions
 
python_lab_manual_final (1).pdf
keerthu0442
 
ANSHUL RANA - PROGRAM FILE.pptx
jeyel85227
 
xii cs practicals
JaswinderKaurSarao
 
Python.pptx
AshaS74
 
This material is Phython programming Course.
Asaminew Adugna
 
Python programming workshop session 3
Abdul Haseeb
 
Python programming –part 3
Megha V
 
Python for Beginners(v3)
Panimalar Engineering College
 
The document discusses for loops in Python. It explains that for loops are us...
xuwnudbek266
 
python_avw - Unit-03.pdf
AshaWankar1
 
Python Lists is a a evry jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...
KavineshKumarS
 
File handling in pythan.pptx
NawalKishore38
 
ADST university of Sussex foundation class
MarufFarhanRigan1
 
Ad

Recently uploaded (20)

PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
Kubernetes - Architecture & Components.pdf
geethak285
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Ad

Torchbearersnotebook.blogspot.com program to create a list in python and values of list will be taken as input (1)

  • 1. 1/8 PROGRAM TO CREATE A LIST IN PYTHON AND VALUES OF LIST WILL BE TAKEN AS INPUT torchbearersnotebook.blogspot.com/2021/07/program-to-create-list-in-python-and.html TO CREATE A LIST OF FRUITS AND TAKE FRUITS AS INPUT WRITE THE PROGRAM GIVEN BELOW: print("Enter fruit number 1:") a = input() print(a) print("Enter fruit number 2:") b = input() print(b) print("Enter fruit number 3:") c = input() print(c) print("Enter fruit number 4:") d = input() print(d) print("Enter fruit number 5:") e = input() print(e) print("Enter fruit number 6:") f = input() print(f)
  • 2. 2/8 PROGRAM TO ADD AN ELEMENT AT THE END OF A LIST: print("Enter fruit number 1:") a = input() print(a) print("Enter fruit number 2:") b = input() print(b) print("Enter fruit number 3:") c = input() print(c) print("Enter fruit number 4:") d = input() print(d) print("Enter fruit number 5:") e = input()
  • 3. 3/8 print(e) print("Enter fruit number 6:") f = input() print(f) print("Enter fruit number 7:") g = input() print(g) myfruitlist=[a, b, c, d, e, f] print(myfruitlist) myfruitlist.append(g) print(myfruitlist) PROGRAM TO ADD AN ELEMENT AT A PARTICULAR INDEXING OF A LIST: print("Enter fruit number 1:") a = input() print(a) print("Enter fruit number 2:") b = input() print(b) print("Enter fruit number 3:")
  • 4. 4/8 c = input() print(c) print("Enter fruit number 4:") d = input() print(d) print("Enter fruit number 5:") e = input() print(e) print("Enter fruit number 6:") f = input() print(f) print("Enter fruit number 7:") g = input() print(g) print("Enter fruit number 8:") h = input() print(h) myfruitlist=[a, b, c, d, e, f, g] print(myfruitlist) myfruitlist.insert(6,h) print(myfruitlist)
  • 5. 5/8 PROGRAM THAT REMOVES AND RETURNS THE LAST VALUE FROM THE GIVEN LIST OR THE GIVEN INDEX: print("Enter fruit number 1:") a = input() print(a) print("Enter fruit number 2:") b = input() print(b) print("Enter fruit number 3:") c = input() print(c) print("Enter fruit number 4:") d = input() print(d) print("Enter fruit number 5:") e = input() print(e) print("Enter fruit number 6:") f = input()
  • 6. 6/8 print(f) print("Enter fruit number 7:") g = input() print(g) print("Enter fruit number 8:") h = input() print(h) myfruitlist=[a, b, c, d, e, f, g, h] print(myfruitlist) myfruitlist.pop() print(myfruitlist) PROGRAM THAT REMOVES A PARTICULAR ELEMENT FROM YOUR LIST: print("Enter fruit number 1:") a = input() print(a) print("Enter fruit number 2:")
  • 7. 7/8 b = input() print(b) print("Enter fruit number 3:") c = input() print(c) print("Enter fruit number 4:") d = input() print(d) print("Enter fruit number 5:") e = input() print(e) print("Enter fruit number 6:") f = input() print(f) print("Enter fruit number 7:") g = input() print(g) print("Enter fruit number 8:") h = input() print(h) myfruitlist=[a, b, c, d, e, f, g, h] print(myfruitlist) myfruitlist.remove(b) print(myfruitlist)
  • 8. 8/8