Skip to content

Instantly share code, notes, and snippets.

@joshuachris2001
joshuachris2001 / 3ddemo.py
Last active February 24, 2025 08:04
Extra-pythons
#"""
#A start of a 3D engine. Use``OK`` to display the faces or edges of cube and ``←↑→↓+-`` to move it.
#**NOTE**: This script work better on Upsilon because ``fill_polygon()`` function doesn't exist in others OS. So we need to re-implement this and is consuming a lot of resources.
#Source: https://my.numworks.com/python/antarctus/cube_move
#"""
#try:
# import os
# if hasattr(os, "environ"):
# os.environ["KANDINSKY_OS_MODE"]= '0'
# os.environ['KANDINSKY_ZOOM_RATIO'] = '2'
@joshuachris2001
joshuachris2001 / trigonwheel.py
Created February 23, 2025 23:56
Trigon-wheel
from math import*
from turtle import*
speed(10)
hideturtle()
width(2)
up()
goto(0,-90)
down()
from math import *
f = lambda x: 13* sin(x)-12
driv_f = lambda x: 13*cos(x)
starting_point = -4
_loop_limits = 20
_loop_snap_shot = 5
_ans = starting_point - ( f(starting_point) / driv_f(starting_point))
@joshuachris2001
joshuachris2001 / dectofrac.py
Last active February 24, 2025 05:26
dectofrac
import math
from math import pi
def decToFrac():
decimal = float(input("Enter a decimal number to convert to a fraction: "))
# Handle negative numbers
is_negative = decimal < 0
decimal = abs(decimal)
# Tolerance for stopping the algorithm