http://sites.google.com/feeds/content/site/primaryprogrammers2019-10-14T22:38:23.531ZPosts of Bronze AnnouncementsGoogle Sites1http://sites.google.com/feeds/content/site/primaryprogrammers/78271879503824102062019-10-08T14:59:31.929Z2019-10-08T14:59:31.933Z2019-10-08T14:59:31.915Z2019-2020 Lesson 1: Hello World and some compute
 print("Hello World!")name = input("What is your name?")print("Hello", name)#Let's do some mathnumber = 69587598 * 76485648654 print(number)print(number)print(56 * 78)
Attila Lengyelprimaryprogrammers@gmail.com2019-2020lesson1helloworldandsomecompute1
http://sites.google.com/feeds/content/site/primaryprogrammers/63874162351667950112019-06-05T15:05:07.441Z2019-06-05T15:05:07.447Z2019-06-05T15:05:07.436ZLesson 22: Turtle in corners and timer
 import turtle as tbob = 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 randomdef 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)
Attila Lengyelprimaryprogrammers@gmail.comlesson22turtleincornersandtimer1
http://sites.google.com/feeds/content/site/primaryprogrammers/40604007699210799392019-05-29T14:52:30.258Z2019-05-29T14:57:03.566Z2019-05-29T14:57:02.257ZLesson 21: Four corners
 import turtle as tbob = 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)
Attila Lengyelprimaryprogrammers@gmail.comlesson22fourcorners4
http://sites.google.com/feeds/content/site/primaryprogrammers/62348266952061566032019-05-08T14:34:04.395Z2019-05-08T15:10:29.578Z2019-05-08T15:10:28.337ZLesson 20: Catch me if you can
 import turtle as tt1 = t.Turtle()t1.shape("turtle")t1.fillcolor("blue")t1.pencolor("blue")t2 = t.Turtle()screen = t.Screen()def draw_rectangle(player, x, y, width, height, color): startpos = player.pos() startcolor = player.pencolor() player.pencolor(color) player.up() player.goto(x, y) player.down() player.forward(width) player.left(90) player.forward(height) player.left(90) player.forward(width) player.left(90) player.forward(height) player.left(90) player.up() player.goto(startpos) player.down() player.pencolor(startcolor)draw_rectangle(t1, -210, -210, 420, 420, "red")def inbox(player): if player.xcor() >= 200: player.up() player.goto(199, player.ycor()) player.down() return False if player.xcor() <= -200: player.up() player.goto(-199, player.ycor()) player.down() return False if player.ycor() >= 200: player.up() player.goto(player.xcor(), 199) player.down() return False if player.ycor() <= -200: player.up() player.goto(player.xcor(), -199) player.down() return False return Truedef f(): if inbox(t1): t1.forward(10)def b(): if inbox(t1): t1.backward(10)def l(): t1.left(10)def r(): t1.right(10)screen.onkey(f, "Up")screen.onkey(b, "Down")screen.onkey(l, "Left")screen.onkey(r, "Right")def catch(): if t1.distance(t2) < 10: t2.write("CATCH!!!") def f2(): if inbox(t2) : t2.forward(10) catch()def b2(): if inbox(t2): t2.backward(10) catch()def l2(): t2.left(10)def r2(): t2.right(10)screen.onkey(f2, "s")screen.onkey(b2, "x")screen.onkey(l2, "z")screen.onkey(r2, "c")screen.listen()
Attila Lengyelprimaryprogrammers@gmail.comlesson20catchmeifyoucan3
http://sites.google.com/feeds/content/site/primaryprogrammers/23719395013300130702019-05-01T15:03:47.920Z2019-05-01T15:03:47.924Z2019-05-01T15:03:47.914ZLesson 19: Turtle Race
 import turtle as tt1 = t.Turtle()t1.shape("turtle")t1.fillcolor("blue")t1.pencolor("blue")t2 = t.Turtle()screen = t.Screen()def f(): t1.forward(10)def b(): t1.backward(10)def l(): t1.left(10)def r(): t1.right(10)screen.onkey(f, "Up")screen.onkey(b, "Down")screen.onkey(l, "Left")screen.onkey(r, "Right")def catch(): if t1.distance(t2) < 10: t2.write("CATCH!!!") t1.clear() t2.clear()def f2(): t2.forward(10) catch()def b2(): t2.backward(10) catch()def l2(): t2.left(10)def r2(): t2.right(10)screen.onkey(f2, "s")screen.onkey(b2, "x")screen.onkey(l2, "z")screen.onkey(r2, "c")screen.listen()
Attila Lengyelprimaryprogrammers@gmail.comlesson19turtlerace1
http://sites.google.com/feeds/content/site/primaryprogrammers/19661059587434329242019-04-17T15:00:57.204Z2019-04-17T15:00:57.210Z2019-04-17T15:00:57.200ZLesson 18: Events handling with Turtle
 import turtlescreen = turtle.Screen()turtle.shape("turtle")turtle.fillcolor("blue")turtle.pencolor("blue")speed = 10turn = 10def f(): turtle.forward(speed) turtle.fillcolor("red") turtle.pencolor("red")def b(): turtle.backward(speed) turtle.fillcolor("blue") turtle.pencolor("blue")def l(): turtle.left(turn)def r(): turtle.right(turn)def c(): turtle.clear()turtle.speed(0)screen.onkey(f, "Up")screen.onkey(b, "Down")screen.onkey(l, "Left")screen.onkey(r, "Right")screen.onkey(c, "c")screen.listen()
Attila Lengyelprimaryprogrammers@gmail.comlesson18eventshandlingwithturtle1
http://sites.google.com/feeds/content/site/primaryprogrammers/5126394299894488942019-04-10T15:01:43.987Z2019-04-10T15:01:43.992Z2019-04-10T15:01:43.983ZLesson 17: Drawing with Turtle
 import turtleted = turtle.Turtle()for i in range(0,4): ted.forward(50) ted.left(90) ted.write("Turn left")ted.penup()ted.setposition(-100,-100)ted.pendown()for i in range(0,5): ted.forward(50) ted.right(144)ted.clear()ted.pencolor("blue")ted.circle(100)ted.clear()ted.penup()ted.setposition(0,0)ted.pendown()num_sides = 5side_length = 10angle = 360 / num_sidesfor i in range(0,num_sides): ted.forward(side_length) ted.right(angle)
Attila Lengyelprimaryprogrammers@gmail.comlesson17drawingwithturtle1
http://sites.google.com/feeds/content/site/primaryprogrammers/20395890251449478792019-04-03T14:53:24.628Z2019-04-03T14:53:24.633Z2019-04-03T14:53:24.623ZLesson 16: What is a palindrome?
 word = input("Give me a sentence:")tmp = ""for i in word: if i.isalnum(): tmp = tmp + i.lower() word = tmps = ""for i in word: s = i + sprint(s) print(word) if s == word: print("This is a palindrome")else: print("This is not a palindrome")
Attila Lengyelprimaryprogrammers@gmail.comlesson16whatisapalindrome1
http://sites.google.com/feeds/content/site/primaryprogrammers/6876881212432792142019-03-27T15:05:19.093Z2019-03-27T15:05:19.099Z2019-03-27T15:05:19.087ZLesson 15: Hangman v1
 word = input("Give me the hidden word:")correctletters = ""incorrectletters = ""def drawhangman(word, correctletters, incorrectletters): output = "" for c in word: if c in correctletters: output += c + " " else: output += "_ " print(output)#drawhangman("rule", "eul", "")#drawhangman("rule", "ul", "")#drawhangman("rule", "l", "")#drawhangman("rule", "", "")#drawhangman("rule", "erul", "")while len(word) != len(correctletters) and len(incorrectletters) < 8: guess = input("Guess a letter:") if guess in word and guess not in correctletters: correctletters += guess elif guess not in incorrectletters: incorrectletters += guess drawhangman(word, correctletters, incorrectletters)
Attila Lengyelprimaryprogrammers@gmail.comlesson15hangmanv11
http://sites.google.com/feeds/content/site/primaryprogrammers/33696518693730993822019-03-22T14:18:18.496Z2019-03-22T14:18:18.501Z2019-03-22T14:18:18.491ZLesson 14: Binary search... for guessing
 print("Think of a number between 0 and 100!")answer = ""upper = 100lower = 0import math as mwhile answer != "correct": guess = m.floor((upper - lower)/2 + lower) print("Did you guess", guess, "?") answer = input() if answer == "correct": print("You thought of", guess,".") elif answer == "low": lower = guess elif answer == "high": upper = guess
Attila Lengyelprimaryprogrammers@gmail.comlesson14binarysearchforguessing1
http://sites.google.com/feeds/content/site/primaryprogrammers/85808161910382578482019-03-13T15:04:25.725Z2019-03-13T15:04:25.733Z2019-03-13T15:04:25.721ZLesson 13: Guess game
 import random as ra = r.randint(0,100)print("I thought of a number between 0 and 100.")print("Guess the number!")counter = 0correct = Falsewhile(correct == False): guess = int(input(":")) counter = counter + 1 if guess == a: correct = True elif guess < a: print("It is too low") else: print("It is too high") if correct: print("Good guess. The nunber is:", a) print("You tried", counter, "times")
Attila Lengyelprimaryprogrammers@gmail.comlesson13guessgame1
http://sites.google.com/feeds/content/site/primaryprogrammers/50353777042132502202019-01-30T16:02:36.489Z2019-01-30T16:02:36.496Z2019-01-30T16:02:36.481ZLesson 12: Rolling dice
 import random#print(random.randint(1,6))result = []for i in range(0, 10000): a = random.randint(1,6) result.append(a)#print(result)print("Rolling one dice:")for i in range (1,7): a = result.count(i) print(i, a)result2 = []for i in range(0, 1000000): a = random.randint(1,6) b = random.randint(1,6) result2.append(a + b)print("Rolling two dice:")for i in range(2,13): a = result2.count(i) print(i, a)
Attila Lengyelprimaryprogrammers@gmail.comlesson12rollingdice1
http://sites.google.com/feeds/content/site/primaryprogrammers/25969201591394978452019-01-23T16:02:19.265Z2019-01-23T16:02:19.270Z2019-01-23T16:02:19.260ZLesson 11: Lists - Raffle
 names = ["Tanisha", "Sahana", "Nadezda","Claire", "Zubin", "Cayne", "Boston","Ameya", "Aryan"]print(names)num = len(names)print(num)import randomwinner = random.randint(0,num - 1)print(winner)print(names[winner])print(sorted(names))print(sorted(names, reverse = True))
Attila Lengyelprimaryprogrammers@gmail.comlesson11lists-raffle1
http://sites.google.com/feeds/content/site/primaryprogrammers/38165736608008579322019-01-16T16:04:34.260Z2019-01-16T16:04:34.266Z2019-01-16T16:04:34.255ZLesson 10: "Repetition makes the master": Fibonacci series with role play
 a = 0 #a gets value of 0b = 1 #b get value of 1c = a + b #c gets value of a plus bprint(a) #a displayeda = b # a gets value of bb = c # b gets value of cc = a + b #c gets value of a plus bprint(a)a = bb = cc = a + bprint(a)for i in range(0,10000): a = b b = c c = a + b print(a)
Attila Lengyelprimaryprogrammers@gmail.comlesson10repetitionmakesthemasterfibonacciserieswithroleplay1
http://sites.google.com/feeds/content/site/primaryprogrammers/43885627091793769722019-01-09T16:09:00.509Z2019-01-11T15:59:20.903Z2019-01-11T15:59:17.980ZLesson 9: Fibonacci series & 4 corners game
 a = 0b = 1print(a)print(b)for i in range(0,5): c = a + b print(c) a = b b = cimport randomimport timefor i in range(0,10): time.sleep(8) print("Corner", random.randint(1,4), "is out!") print("Run to an other corner!!!")
Attila Lengyelprimaryprogrammers@gmail.comlesson9fibonaccisequence4cornersgame2
http://sites.google.com/feeds/content/site/primaryprogrammers/79859372696212970772018-12-19T16:07:34.006Z2018-12-19T16:07:34.011Z2018-12-19T16:07:34.002ZLesson 8: "What year were you born?" - Strings and Dates
 age = int(input("How old are you?:"))year = 2018birth = year - ageprint("Where you born in", birth, "?")import time, datetimeprint(datetime.date.today())today = str(datetime.date.today())print(today)month = today + todayprint(month)day = today + todayprint(day)question = "Is your birthday before " + month + "/" + day + "?"answer = input(question)if answer == "no": birth = year - age - 1print("Where you born in " + str(birth) + ".")
Attila Lengyelprimaryprogrammers@gmail.comlesson8whatyearwereyouborn-stringsanddates1
http://sites.google.com/feeds/content/site/primaryprogrammers/2364577327445735632018-12-12T16:03:02.159Z2018-12-12T16:03:02.163Z2018-12-12T16:03:02.155ZLesson 7: Multiplication test (Variables, Control-flow, Loops)
 import randomprint("How many questions?")q = int(input())score = 0for i in range(0,q): a = random.randint(2,12) b = random.randint(2,12) print("What is", a, "x", b, "?") c = int(input()) if a * b == c: print("o - Correct. It is", c) score = score + 1 else: print("x - Incorrect. It is", a * b)print("You scored", score, "points")print("Percentage: ", (score / q) * 100,"%")
Attila Lengyelprimaryprogrammers@gmail.comlesson7multiplicationtestvariablescontrol-flowloops1
http://sites.google.com/feeds/content/site/primaryprogrammers/15578381273667495732018-12-05T16:03:39.839Z2018-12-05T16:03:39.843Z2018-12-05T16:03:39.835ZLesson 6: Loops - Head or Tail?
 for i in range(1,12): print(i)import randomwins = 0losses = 0for i in range(0,5): flip = random.randint(0,1) coin = "Head" if flip == 0: coin = "Tail" answer = input("Head or Tail?:") if answer == coin: print("You won! It was", coin) wins = wins + 1 else: print("You Lost! It was", coin) losses = losses + 1print("You won", wins, "times")print("You lost", losses, "times")
http://sites.google.com/feeds/content/site/primaryprogrammers/591238015136284522018-11-28T16:06:01.181Z2018-11-28T16:06:01.184Z2018-11-28T16:06:01.177ZLesson 5: Multiplication test
 print("What is 7 x 7?")answer = int(input())if answer == 49: print("Good job! Correct.") print(" 7 x 7 is", 7 * 7)else: print("No. Incorrect") print("How could 7 x 7 be", answer, "???") print("Try again!")import randoma = random.randint(1,10)b = random.randint(1,10)print("What is", a, "x", b, "?" )answer = int(input())if answer == a * b: print("Correct")
Attila Lengyelprimaryprogrammers@gmail.comlesson5multiplicationtest1
http://sites.google.com/feeds/content/site/primaryprogrammers/17966675018799555002018-11-16T16:00:58.875Z2018-11-16T16:00:58.881Z2018-11-16T16:00:58.870ZLesson 4: Control flow
 print("Control flow")a = int(input("Give me a number:"))if a < 10: print("The number is smaller then 10") print("This is block 1")elif a == 10: print("The number is 10") print("This is block 2")else: print("The number is greater then 10") print("This is block 3")print ("This is the main flow")b = int(input("Give me a second number:"))op = input("Give me an operation:")if op == "+": print(a, "+", b, "=", a+b)elif op == "-": print(a, "-", b, "=", a-b)elif op == "*": print(a, "*", b, "=", a*b)elif op == "/": print(a, "/", b, "=", a/b)
Attila Lengyelprimaryprogrammers@gmail.comlesson4controlflow1
http://sites.google.com/feeds/content/site/primaryprogrammers/91681899204082478942018-11-07T16:03:45.976Z2018-11-07T16:03:45.980Z2018-11-07T16:03:45.971Z2018-19 Lesson 3: Strings and Integers
 print("Hello World!!!")name = input("What is your name?:")message = "Hello " + name + "! Nice meeting you!"print("Hello", name, "! Nice meeting you")print(message)print(name)a = int(input("Give me a number:"))b = int(input("Give me second number:"))print("Sum of the two number is", a + b)print("Difference of the two number is", a - b)print("Product of the two number is", a * b)print("Quotient of the two number is", a / b)print("a on the power of b is", a**b)
Attila Lengyelprimaryprogrammers@gmail.com2018-19lesson3stringsandintegers1
http://sites.google.com/feeds/content/site/primaryprogrammers/19855915270835755362018-10-10T15:06:00.874Z2018-10-10T15:06:00.877Z2018-10-10T15:06:00.859Z2018-19 Lesson 2: Cooking eggs
 print("Step 1: Get eggs from frigde.")num_eggs = int(input("How many people?"))num_eggs = num_eggs * 2print("Step 2: Get a fry pan.")print("Step 3: Cook", num_eggs, "eggs")
Attila Lengyelprimaryprogrammers@gmail.com2018-19lesson2cookingeggs1