Skip to content

Instantly share code, notes, and snippets.

from fractions import Fraction
def mixed(k):
m = int(k)
f = k-m
if m == 0:
return(str(f))
if f == 0:
return(str(m))
return(str(m) + " " + str(f))
def replaceAccents(l):
"""
replace greek accents
"""
l = l.lower()
rDict = {'ά':'α','ό':'ο','ύ':'υ','ϋ':'υ','ΰ':'υ','έ':'ε','ί':'ι',
'ϊ':'ι','ΐ':'ι','ή':'η','ώ':'ω','ς':'σ'}
retStr = ''
for x in l:
retStr += (x if x not in rDict else rDict[x])
from microbit import *
def showEL(greekLetter):
greekLetters = {"Α": Image("09900:90090:99990:90090:90090"),
"Β": Image("99900:90090:99900:90090:99900"),
"Γ": Image("99990:90000:90000:90000:90000"),
"Δ": Image("09900:90090:90090:90090:99990"),
"Ε": Image("99990:90000:99900:90000:99990"),
"Ζ": Image("99990:00900:09000:90000:99990"),
"""
github.com/dimnikolos
2019
"""
import re
import scholarly
with open('citescount.html','w',encoding='utf-8') as resf:
#cites.txt is your bibliography/reference in a text file
#a line per reference
from fractions import Fraction
def fromrepeating(r):
if type(r) == int:
return(Fraction(r,1))
if type(r) == float:
return(Fraction(int(str(r).replace('.','')),10**(len(str(r))-str(r).index('.')-1)))
if type(r) != str:
return(None)
if 'r' not in r:
try: