List-Test

Sun 29 June 2025
entries = ['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 More

List2Table

Sun 29 June 2025
import 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 More

List2Table-D-Pandas

Sun 29 June 2025
import 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 More

Match-All-String

Sun 29 June 2025
one = "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

Math-Module

Sun 29 June 2025
#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 More

More-Itertools

Sun 29 June 2025
import 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 More

My-Personal-Pynotes-Growth

Sun 29 June 2025
import 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>]

png



Score: 5

Category: basics

Read More

Name-Meter

Sun 29 June 2025
def 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 More

Np-Full

Sun 29 June 2025
import 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

Num-Counter

Sun 29 June 2025
from collections import defaultdict
counter = defaultdict(int)
content = "one 2 1 three 4 2 1 7 6 six 8 9 8"
content
'one 2 1 three 4 2 1 7 6 six 8 9 8'
for c in content.split(' '):
    if(c.isdigit()):
        counter[c] += 1
counter
defaultdict(int, {'2 …

Category: basics

Read More
Page 4 of 7

« Prev Next »