This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import timeit | |
from decimal import * | |
getcontext().prec = 200 | |
print ("A PI értékének számítása folyamatban...") | |
def calc (prec = 100): | |
pi = Decimal(0) | |
for k in range (prec): | |
pi = pi + Decimal( (1/(16**k))*( (4/(8*k+1))-(2/(8*k+4))-(1/(8*k+5))-(1/(8*k+6)) ) ) | |
print (pi) | |
print (timeit(calc, number = 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import timeit | |
from decimal import * | |
getcontext().prec = 101 | |
print ("A PI értékének számítása folyamatban...") | |
def calc (prec = 80): | |
pi = Decimal(0) | |
for k in range (prec): | |
pi = pi + Decimal( (Decimal(1)/Decimal(16**k))*( (Decimal(4)/Decimal(8*k+1))-(Decimal(2)/Decimal(8*k+4))-(Decimal(1)/Decimal(8*k+5))-(Decimal(1)/Decimal(8*k+6)) ) ) | |
print (k) | |
print (pi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import timeit | |
from decimal import * | |
getcontext().prec = 101 | |
print ("A PI értékének számítása folyamatban...") | |
def calc (prec = 80): | |
pi = Decimal(0) | |
for k in range (prec): | |
pi = pi + (Decimal(1)/Decimal(str(16**k)))*( (Decimal(4)/Decimal(str(8*k+1)))-(Decimal(2)/Decimal(str(8*k+4)))-(Decimal(1)/Decimal(str(8*k+5)))-(Decimal(1)/Decimal(str(8*k+6))) ) | |
print (k) | |
print (pi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def kilepes(): | |
print ("A kilépés megkezdődik...") | |
def belepes(): | |
print ("Bejelentkezés...") | |
def fo_menu(navig): | |
for e in enumerate(navig): | |
print("{0}. {1}".format(str(e[0]), e[1].__name__)) | |
valasz = int(input("Add meg a menüpont számát:")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def faktorialis (a): | |
s = 1 | |
for szam in range(1,a+1): | |
s = s*szam | |
return s | |
a = int(input ("szam:")) | |
def pascalharomszog (i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "creature.h" | |
#include <iostream> | |
using namespace std; | |
/* Default Constructor */ | |
Creature::Creature() | |
{ | |
Name = "Default"; | |
Health = 0; |