wmclt / kaprekarsnumber Goto Github PK
View Code? Open in Web Editor NEWLittle project to learn Python and calculate Kaprekar's number.
License: MIT License
Little project to learn Python and calculate Kaprekar's number.
License: MIT License
Some digit spaces don't only have Kaprekar's numbers, but also loops.
Code for inspiration. It draws a tree using purely packages packed with Python 2.
from turtle import *
from types import *
myTree = ["A",["B",["C",["D","E"],"F"],"G","H"]];
s = 50;
startpos = (0,120)
def cntstrs(list):
return len([item for item in list if type(item) is StringType])
def drawtree(tree, pos, head=0):
c = cntstrs(tree)
while len(tree):
goto(pos)
item = tree.pop(0)
if head:
write(item,1)
drawtree(tree.pop(0),pos)
else:
if type(item) is StringType:
newpos = (pos[0] + s*c/4 - s*cntstrs(tree), pos[1] - s)
down()
goto((newpos[0], newpos[1] + 15))
up()
goto(newpos)
write(item,1)
elif type(item) is ListType:
drawtree(item,newpos)
up()
drawtree(myTree, startpos,1)
if branch node has 5 leaves => breadth == 5
if branch node has 3 leaves and one child branch with 4 leaves => breadth == 7
etc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.