Y

@YSS

Ppp

Python
7 months ago
import dis def ad(a, b): return (b*(a % b))% a # バイトコードを逆アセンブル dis.dis(ad) print(ad(11,3)) print(ad(ad(11,3),4))

H

Python
7 months ago
import time # コンテキストマネージャを使ったシンプルなタイマー class Timer: def __enter__(self): self.start = time.time() return self def __exit__(self, *args): end = time.time()

F

Python
7 months ago
A=[1,2] for i in range(12): print(A) K=len(A)-1 A.append(A[K]+A[K-1])

Yyu

Bash
7 months ago
#!/bin/bash x=(1 2) len=${#x[@]} # 最後の2つ idx=${x[$((len - 1))]} Idy=${x[$((len - 2))]} sum=$(( x[$idx] - x[$Idy] ))

Pp

Python
7 months ago
class A: def __init__(self, x): self.x = x def BS(self): for j in range(10): for i in range(len(self.x) - 1): if self.x[i] > self.x[i+1]: th = self.x[i] sel

Qq

Python
7 months ago
import dis def f(x): for A in range(len(x)-1): if x[A] > x[A+1]: h=x[A] x[A]=x[A+1] x[A+1]=h return x

ASZXD

Python
7 months ago
F = {} class T: def __init__(L, R, Q, S): L.R = R L.Q = Q L.S = S def Rem(L): F[f"{L.R}"] = (f"{L.Q}") return f"{L.R}→{L.Q},add"

おおおお

Python
7 months ago
# 超簡単バージョン(1時間で作れる) class BabyAI: def __init__(self): self.words = {} self.memory = [] def talk(self, th0): # 人類の言葉をランダムにマネする th1 = th0.split() if th1 and random.random() > 0.7:

素数でBash

Bash
7 months ago
#!/bin/bash count=1 while [ $count -le 120 ]; do C1=$((count % 2)) # 変数名をASCII文字に変更 C2=$((count % 3)) C3=$((count % 5)) C4=$((count % 7)) if [ $count -eq 1 ]; then

A

Bash
7 months ago
#!/bin/bash A=1 while [ $A -le 16 ]; do B=1 while [ $B -le 16 ]; do C=$(( A + B )) echo " $A+$B=$C" ((B++)) done

Ts

Python
7 months ago
import random oks = [ "A","B","C", "D","E","F", "G","H","I", "J","K","L", "M","N","O", "P","Q","R", "S","T","U",

T

Python
7 months ago
import random oks = [ "A","B","C", "D","E","F", "G","H","I", "J","K","L", "M","N","O", "P","Q","R", "S","T","U",

涙でソート

Python
7 months ago
lst = [1,1,4,5,1,4] print(lst) LST = [1,1,4,5,1,4] SSS= [] for i in range(10): for j in range(len(LST)): LST[j]=LST[j]-1 if LST[j] == 0: SSS.append(lst[j])

Pppp

Python
7 months ago
import numpy as np import matplotlib.pyplot as plt x = np.linspace(1, 100, 100) y = (2**(x+1))-1 plt.plot(x, y) plt.title("y") plt.xlabel("x") plt.show()

バブルソート

Python
7 months ago
F=[0,71,62,53,44,35,26,17,0,] for i in range(10): for k in range(len(F)-1): print(F) if F[k] > F[k+1]: J=F[k+1] F[k+1]=F[k] F[k]=J

Ttt

Python
7 months ago
o1=["°","•","-","_",] o2=[] p1=[0,0,0,0,0,0,0,] for A in range(len(o1)): for B in range(len(o1)): o2.append(f'{o1[A]} {o1[B]}') p1[(A*(len(o1)**0))+(B*(len(o1)**0))]=p1[(A*(len(o1)**0))+(B*(len(o1)**0))]+1 print(o2) print(p1)

At

Python
7 months ago
At = lambda x: (x**2)**0.5 print(At(5)) # 25

tttて

Python
7 months ago
import re class AHOInterpreter: def __init__(self): self.vars = {} self.funcs = {} def parse_value(self, raw): """型サフィックスに基づき値を変換""" if raw.endswith("_n"):

TYLHFUZEN

Python
7 months ago
def T(Y): if Y >= 0: return Y*1 # そのまま else: return Y*-1 # マイナスを反転 def MR(x): if x >= 0: return int(x + 0.5) else:

Tttt

Python
7 months ago
toH=3.4 print(f'{toH}') if toH > 0: yaj=toH - (toH % 1)+0 if toH > yaj+0.5: toH=yaj+1 else: