Skip to content

Instantly share code, notes, and snippets.

View yakkomajuri's full-sized avatar

Yakko Majuri yakkomajuri

View GitHub Profile
from browser import document, html, window
from javascript import Math
score = 0
high_score = 0
px = py = 10
gs = tc = 20
ax = ay = 15
xv = yv = 0
trail = []
/*
Original Code Credits: Chris DeLeon of HomeTeam GameDev
Modified by: Yakko Majuri
*/
'use strict'
let canvas, ctx;
window.onload = function () {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Brython Snake</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.8.9/brython.min.js">
</script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
proc fibonacci(n: int): int =
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
echo(fibonacci(40))
#include <stdio.h>
int fibonacci(int n) {
if (n <= 1) {
return n;
}
return fibonacci(n-1) + fibonacci(n-2);
}
int main(void) {
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(40))
#include <stdio.h>
int fibonacci(int n) {
if (n <= 1) {
return n;
}
return fibonacci(n-1) + fibonacci(n-2);
}
int main(void) {
import strformat
# Example taken from the Nim Website: https://nim-lang.org/
type
Person = object
name: string
age: Natural # Ensures the age is positive
let people = [
evens = [i for i in range(100) if i % 2 == 0]
squares = [i**2 for i in evens]
pairs = [(x,y) for x in range(100) for y in range(100)]
squarepairs = [(i, i**2) for i in range(100) if i % 2 == 0]
x, y, z = (4, 5, 6)
x, *xs = [1, 2, 3, 4]
x, y = 4, 5