How to remove the last item from a list in Python

2 Answers

0 votes
programming = ['Python', 'C#', 'Java', 'C', 'PHP', "C++", "Java"]

programming.pop()

print(programming)



'''
run:

['Python', 'C#', 'Java', 'C', 'PHP', 'C++']

'''

 



answered Sep 23, 2017 by avibootz
edited Apr 22, 2024 by avibootz
0 votes
programming = ['Python', 'C#', 'Java', 'C', 'PHP', "C++", "Java"]

index = programming.pop()

print(programming)

print(index)



'''
run:

['Python', 'C#', 'Java', 'C', 'PHP', 'C++']
Java

'''

 



answered Sep 23, 2017 by avibootz
edited Apr 22, 2024 by avibootz

Related questions

2 answers 202 views
1 answer 200 views
7 answers 936 views
1 answer 165 views
...