Feeli-Song-Csv

Sat 17 May 2025

title: "Feeli Song Collection" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


from io import BytesIO
import requests
import pandas as pd
filename = 'https://docs.google.com/spreadsheet/ccc?key=1EfyD7A4YcdAzTfUO0t3yQ0HawetVF5pefS5pPyGVX4g&output=csv'

r = requests.get(filename)
data = r.content
df = pd.read_csv(BytesIO(data), index_col=0 …

Category: basics

Read More

Fibonacci

Sat 17 May 2025

title: "Fibonacci" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


def fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)
print(fib(8))
21
print(fib(89))


Score: 5

Category: basics

Read More

Fibonacci-Generator

Sat 17 May 2025

title: "Fibonacci in Generator" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


def fibonacci(n):
    a = b = 1

    for i in range(n):
        yield a
        a, b = b, a+b
print(2)
2
for x in fibonacci(10):
    print(x)
1
1
2
3
5
8
13
21
34 …

Category: basics

Read More

Fibonacci Lambda

Sat 17 May 2025

title: "Fibonacci Lambda" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


def print_fibo(number):
    print(list(map(lambda x, f = lambda x, f : (f(x-1,f) + f(x-2,f)) if x > 1 else 1: f(x,f), range(number))))
print_fibo(6)
[1, 1, 2, 3 …

Category: basics

Read More

Find Python Location

Sat 17 May 2025

title: "Find Python Location" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


import sys
print(sys.executable)
/Users/rajacsp/anaconda3/bin/python


Score: 0

Category: basics

Read More

Function-Caching

Sat 17 May 2025

title: "Function Caching" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


from functools import lru_cache
@lru_cache(maxsize=10)
def add(a, b):
    print('add method called')
    return a+b
print(add(7, 4))
add method called
11
print(add(7, 4))
11
print(add(5, 2))
add method called …

Category: basics

Read More

Function With Return Type

Sat 17 May 2025

title: "Function With Return Type" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


def square(a):
    return a * a
print(square(5))
25
def square(a:int) -> int:
    return a * a
print(square(4))
16
def square_1(a:int) -> str:
    return a * a
print(square_1(15))
225 …

Category: basics

Read More

Fuzzy-String-Ratio

Sat 17 May 2025

title: "Fuzzy String Ratio" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


from fuzzywuzzy import fuzz
print(fuzz.ratio("this is a test", "this is a test!"))
97
print(fuzz.ratio("this is a cup", "this is a world cup"))
81

Score: 0

Category: basics

Read More

Generator-Expressions

Sat 17 May 2025

title: "Generator Expressions Simple" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


abc = [6, 8, 23, 2, 19]
abc
[6, 8, 23, 2, 19]
result = [x for x in abc if(x > 6)]
result
[8, 23, 19]
square = [x*x for x in result]
square
[64, 529, 361]
# More …

Category: basics

Read More

Generator-Sample-1

Sat 17 May 2025

# Example: Loop through a generator and print its values
def sample_generator():
    for i in range(5):  # Generates numbers 0 to 4
        yield i
gen = sample_generator()  # Create the generator
gen
<generator object sample_generator at 0x7fe180371000>
for value in gen:  # Loop through the generator
    print(value)
0
1
2
3
4


Score …

Category: basics

Read More
Page 5 of 17

« Prev Next »