Bronze Announcements


Lesson 9: Rolling the dice

posted Dec 10, 2019, 8:03 AM by Attila Lengyel   [ updated Dec 12, 2019, 7:59 AM ]

import random as r

print("Let's roll the dice!")
print("I rolled", r.randint(1,6))

rolls = [0,0,0,0,0,0]

for x in range(0,1000):
roll = r.randint(1,6)
rolls[roll-1] = rolls[roll-1] + 1

print(rolls)

total = sum(rolls)

for x in range(0,6):
prob = (rolls[x] / total) * 100
print("The probablity to roll", x + 1, "is", prob, "%")

rolls2 = [0,0,0,0,0,0,0,0,0,0,0,0]
for x in range (0,1000000):
d1 = r.randint(1,6)
d2 = r.randint(1,6)
rolls2[d1+d2-1] = rolls2[d1+d2-1] + 1

for x in range(0,12):
print(x + 1, rolls2[x])

Lesson 8: Fibonacci sequence with for loop and list

posted Dec 3, 2019, 7:56 AM by Attila Lengyel

a = 1
b = 1
c = a + b

print(a,b,c)

a = b
b = c
c = a + b

print(a,b,c)

a = b
b = c
c = a + b

print(a,b,c)

print("I'm the while loop")
i = 0
while i < 10:
a = b
b = c
c = a + b
print(a,b,c)
i = i + 1

print("I'm the for loop")
for x in range(0,10):
a = b
b = c
c = a + b
print(a,b,c)

f = [1,1,2]
for x in range(0,22):
f.append(f[len(f)-1] + f[len(f)-2])
print(f)



Lesson 7: While loop and testing multiplication skills

posted Nov 19, 2019, 7:59 AM by Attila Lengyel

a = 5
b = 7
c = a * b
print(c)

import random as r
a = r.randint(0,10)
b = r.randint(0,10)
c = a * b
print(a,"*", b, "=", c)

a = r.randint(0,10)
b = r.randint(0,10)
print("What is", a, "*", b, "?")
answer = int(input(":"))
if answer == a * b:
print("Good job!!!")
else:
print("Incorrect! It is", a * b)

lower = 10
upper = 20
i = 0
while i < 10:
print(i)
a = r.randint(lower,upper)
b = r.randint(lower,upper)
print("What is", a, "*", b, "?")
answer = int(input(":"))
if answer == a * b:
print("Good job!")
else:
print("Incorrect! It is", a * b)
i = i + 1

Lesson 6: The big IF

posted Nov 14, 2019, 7:58 AM by Attila Lengyel

a = int(input("give me a number:"))

if a < 10:
print("a is smaller than 10")
elif a == 10:
print("a equals to 10")
else:
print("a is greater than 10")

print("the task is done")

print(10%2)
print(9%2)

if a % 2 == 0:
print("a is an even number")
else:
print("a is an odd number")

if a % 2 == 0 and a < 10:
print("a is a even number smaller than 10 ")

Lesson 5: Lists in Python

posted Nov 5, 2019, 7:57 AM by Attila Lengyel

bronze = ["Marc"]
bronze.append("Neil")
bronze.append("Celina")
bronze.append("Ariana")
bronze.append("Jacob")
bronze.append("Soha")
bronze.append("Bryn")
bronze.append("Ben")
bronze.append("Parsa")
bronze.append("Naitik")
bronze.append("Nikhil")
bronze.append("Kalin")
bronze.append("Kian")
bronze.append("Ayan")
bronze.append("Supriya")
bronze.append("Johann")
bronze.append("Elizabeth")
bronze.append("Anuva")
bronze.append("Alexsys")
bronze.append("Arjun")
#print(len(bronze))
#print(bronze)
#print(bronze[3])

import random
player1 = random.randint(0, len(bronze)-1)
player2 = random.randint(0, len(bronze)-1)
print(bronze[player1], "please play against", bronze[player2])

bronze.sort()
print(bronze)
bronze.reverse()
print(bronze)











Lesson 4: Road trip planner

posted Oct 29, 2019, 7:55 AM by Attila Lengyel

distance = 24901
mpg = 15
tanksize = 50
price = 3.80
speed = 20

totalgas = (2 * distance) / mpg
stops = totalgas/tanksize
cost = totalgas * price
totaltime = (2 * distance) / speed
totaltime = totaltime + stops * 0.3
totaltime = totaltime / 24

print("You will need to stop", stops, "times")
print("The gas will cost you", cost, "dollars")
print("It will take you", totaltime, "days")

Lesson 2: Rock, Paper, Scissors

posted Oct 15, 2019, 9:31 AM by Attila Lengyel

import random

guess = random.randint(0,2)

if guess == 0:
print("Rock")
if guess == 1:
print("Paper")
if guess == 2:
print("Scissors")

2019-2020 Lesson 1: Hello World and some compute

posted Oct 8, 2019, 7:59 AM by Attila Lengyel

print("Hello World!")
name = input("What is your name?")
print("Hello", name)

#Let's do some math

number = 69587598 * 76485648654
print(number)
print(number)

print(56 * 78)

Lesson 22: Turtle in corners and timer

posted Jun 5, 2019, 8:05 AM by Attila Lengyel

import turtle as t

bob = t.Turtle()
bob.shape("turtle")
def move(x,y,corner):
bob.clear()
bob.speed(0)
bob.penup()
bob.goto(x,y)
bob.pendown()
for x in range(0,3):
bob.forward(40)
bob.left(120)

def turtlewrite(message):
bob.write(message, font=("Arial", 64, "normal"))

import time
import random

def select():
for x in range(0,7):
bob.clear()
turtlewrite(7 - x)
time.sleep(1)

corner = random.randint(1,4)
if corner == 1:
move(200, 200, 1)
elif corner == 2:
move(-200, 200, 2)
elif corner == 3:
move(-200, -200, 3)
else:
move(200, -200, 4)

for x in range(0,10):
select()
time.sleep(2)
move(0,0,0)

Lesson 21: Four corners

posted May 29, 2019, 7:52 AM by Attila Lengyel   [ updated May 29, 2019, 7:57 AM ]

import turtle as t

bob = t.Turtle()
bob.shape("turtle")


def move(x,y,corner):
bob.clear()
bob.speed(0)
bob.penup()
bob.goto(x,y)
bob.pendown()
for x in range(0,3):
bob.forward(40)
bob.left(120)

bob.write("Corner ", corner)

move(-200, 200, 2)
move(0,0,0)
move(200, 200, 1)
move(0,0,0)
move(-200, -200, 3)
move(0,0,0)
move(200, -200, 4)

1-10 of 54