List-Remove
Sun 29 June 2025
names = [
"Kevin",
"Peter",
"John"
]
names
['Kevin', 'Peter', 'John']
names.pop(0)
'Kevin'
names
['Peter', 'John']
Score: 5
Category: basics
Read Morenames = [
"Kevin",
"Peter",
"John"
]
names
['Kevin', 'Peter', 'John']
names.pop(0)
'Kevin'
names
['Peter', 'John']
Score: 5
Category: basics
Read Moreentries = ['one', 2, 'three', False]
print(entries)
['one', 2, 'three', False]
print(entries[2:7])
['three', False]
entryTuple = (100, 200, 'three', 'four')
print(entryTuple)
(100, 200, 'three', 'four')
cities = ['Toronto', 'Monteal', 'Vancouver']
print(cities)
['Toronto', 'Monteal', 'Vancouver']
users = [
('Anders', 'A', 21),
('Balmer', 'B', 45),
('Stephe', 'S', 24)
]
print(users)
[('Anders …Category: basics
Read Moreimport pandas as pd
from IPython.display import display
# Example list of tuples
data = [
(1, 'Alice', 25),
(2, 'Bob', 30),
(3, 'Charlie', 35)
]
# Convert the list of tuples to a DataFrame
df = pd.DataFrame(data, columns=['ID', 'Name', 'Age'])
# Set display options
pd.set_option('display.max_rows', 100)
pd.set_option('display …Category: basics
Read Moreimport pandas as pd
from IPython.display import display
# Example list of tuples
data = [
(1, 'Alice', 25),
(2, 'Bob', 30),
(3, 'Charlie', 35)
]
# Convert the list of tuples to a DataFrame
df = pd.DataFrame(data, columns=['ID', 'Name', 'Age'])
# Set display options
pd.set_option('display.max_rows', 100)
pd.set_option('display …Category: basics
Read Moreone = "Toronto is nice"
one
'Toronto is nice'
one_array = one.split(" ")
two = "It is nice to be in Toronto"
two_array = two.split(" ")
two_array
['It', 'is', 'nice', 'to', 'be', 'in', 'Toronto']
all(x in two for x in one_array)
True
Score: 5
Category: basics
Read More#Number Basics
import math
print(math.ceil(4.3))
5
print(math.floor(4.8))
4
print(math.floor(-4.2))
-5
print(math.fabs(-3.7))
3.7
print(math.fabs(3.7))
3.7
print(math.trunc(3.9))
3
print(math.trunc(-3.9))
-3
print(math …Category: basics
Read Moreimport itertools as it
import more_itertools as mit
a = it.count(0, 2)
mit.take(10, a)
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
Score: 0
Category: basics
Read Moreimport matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6, 7]
y = [
0,
220,
380,
500,
540,
540,
590,
]
y
[0, 220, 380, 500, 540, 540, 590]
plt.plot(x, y, 'ro')
# plt.axis([0, 10, 20, 100])
[<matplotlib.lines.Line2D at 0x211796c3830>]

Score: 5
Category: basics
Read Moredef get_int(c):
if(c == 'a'):
return (200 + ord(c))
if(c == 'e'):
return (250 + ord(c))
if(c == 'i'):
return (300 + ord(c))
if(c == 'o'):
return (350 + ord(c))
if(c == 'u'):
return (400 + ord(c))
return ord(c)
def get_name_meter(name, cache={}):
if name in cache:
return …Category: basics
Read Moreimport pyutil as pyu
pyu.get_local_pyinfo()
'conda env: C:\\Users\\Afia Jahan\\anaconda3\\envs\\py312; pyv: 3.12.11 | packaged by Anaconda, Inc. | (main, Jun 5 2025, 12:58:53) [MSC v.1929 64 bit (AMD64)]'
print(pyu.ps2("pandas"))
Name: pandas
Version: 2.3.0
Summary: Powerful data structures …Category: basics
Read More