May 03 Sample programs

posted May 3, 2016, 4:52 PM by Attila Lengyel
#Four corners game
import random
import time


for x in range(0,100):
    time.sleep(1)
    print(x)
    if x%5 == 0 and x != 0:
        print("The loosing corner is ", random.randint(1,4))

#Fibonacci sequence
v1 = 0
v2 = 1
v3 = v2 * v1
  
print(v1)
print(v2)

for x in range(0,100):
    print(v3)
    v1 = v2
    v2 = v3
    v3 = v2 * v1


Comments