├── presentation └── .stub ├── code ├── guess-range │ ├── guess-range-0.py │ ├── guess-range-1.py │ ├── guess-range-2.py │ └── guess-range-3.py └── guess-equal │ └── guess-equal.py └── README.md /presentation/.stub: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/guess-range/guess-range-0.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | print("\n\nO computador vai pensar em um número de 1 a 10.\nTente adivinhar que número é esse!\n\n") 4 | 5 | resposta = randint(1,11) 6 | 7 | tentativa = int(input("Qual o seu chute? ")) 8 | 9 | if (tentativa > resposta): 10 | print("Errou! Era um número menor!\n") 11 | elif (tentativa < resposta): 12 | print("Errou! Era um número maior!\n") 13 | else: 14 | print("Você acertou!\n") 15 | 16 | -------------------------------------------------------------------------------- /code/guess-range/guess-range-1.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | print("\n\nO computador vai pensar em um número de 1 a 100.\nTente adivinhar que número é esse!\nAtenção nas dicas!\n\n") 4 | 5 | resposta = randint(1,101) 6 | 7 | acertou = False 8 | 9 | numero_tentativas = 0 10 | 11 | while numero_tentativas < 10: 12 | 13 | numero_tentativas = numero_tentativas + 1 14 | 15 | print("=> Tentativa " + str(numero_tentativas)) 16 | 17 | tentativa = int(input("Qual o seu chute? ")) 18 | 19 | if (tentativa > resposta): 20 | print("Tente um número menor!\n") 21 | elif (tentativa < resposta): 22 | print("Tente um número maior\n") 23 | else: 24 | acertou = True 25 | break 26 | 27 | if acertou: 28 | print("\nVocê acertou!\n") 29 | else: 30 | print("\nSuas tentativas acabaram! Tente de novo!\n") 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to Computational Thinking 2 | 3 | This is an introductory talk about computational thinking for beginners. 4 | The aim is to present the task of programming not just as 5 | writing lines of code, but as a way of abstracting complex problems, through 6 | logic, criativity and Computer Science's fundamentals, 7 | for solving them using a sequence of well-defined steps. 8 | Programming logic is first presented using online 9 | programming blocks tools, then a simple guessing game (check the `code/guess-range` folder) 10 | is written in Python for getting the audience familiar 11 | with basic Python constructions. 12 | 13 | ## Experiences 14 | 15 | - Campus Party Natal (14/04/2018) 16 | 17 | To be presented by Vitor, Vinícius, Artur and Professor Leonardo, in the first edition of the Campus Party in Natal 18 | (Rio Grande do Norte, Brazil). 19 | -------------------------------------------------------------------------------- /code/guess-equal/guess-equal.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | print(": ) \n\nOlá! Será que você é bom em adivinhar?\n\nO computador vai pensar em um número de 0 a 9 e você deverá dizer qual é!") 4 | 5 | jogadas = int(input("=> Quantas vezes você quer jogar? ")) 6 | 7 | acertos = 0 8 | 9 | for i in range (0, jogadas): 10 | 11 | print("\n(*) Jogada " + str(i + 1) + "\n") 12 | 13 | resposta = randint(0,9) 14 | 15 | print("O computador já pensou!\n") 16 | 17 | jogou = False 18 | 19 | while not jogou: 20 | 21 | tentativa = int(input("=> Qual o seu chute? ")) 22 | 23 | if (tentativa < 0 or tentativa > 9): 24 | print("Só números de 0 a 9!") 25 | else: 26 | jogou = True 27 | if (tentativa == resposta): 28 | acertos = acertos + 1 29 | print("\nAcertou!") 30 | else: 31 | print("\nErrou! A resposta era " + str(resposta)) 32 | break 33 | 34 | print("\n\nVocê acertou " + str(acertos) + "!") 35 | -------------------------------------------------------------------------------- /code/guess-range/guess-range-2.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | print("\n\nVocê terá de adivinhar um número que está dentro de uma faixa de valores! Que faixa é essa?\n") 4 | 5 | min_valor = int(input("Menor valor: ")) 6 | max_valor = int(input("Maior valor: ")) 7 | 8 | print("\n\nO computador vai pensar em um número de "+ str(min_valor) +" a "+ str(max_valor) 9 | +".\nTente adivinhar que número é esse!\nAtenção nas dicas!\n\n") 10 | 11 | max_tentativas = int(input("Quantas vezes quer tentar? ")) 12 | 13 | resposta = randint(min_valor, max_valor + 1) 14 | 15 | acertou = False 16 | 17 | numero_tentativas = 0 18 | 19 | while numero_tentativas < max_tentativas: 20 | 21 | numero_tentativas = numero_tentativas + 1 22 | 23 | print("=> Tentativa " + str(numero_tentativas)) 24 | 25 | tentativa = int(input("Qual o seu chute? ")) 26 | 27 | if (tentativa > resposta): 28 | print("Tente um número menor!\n") 29 | elif (tentativa < resposta): 30 | print("Tente um número maior\n") 31 | else: 32 | acertou = True 33 | break 34 | 35 | if acertou: 36 | print("\nVocê acertou!\n") 37 | else: 38 | print("\nSuas tentativas acabaram! Tente de novo!\n") 39 | 40 | -------------------------------------------------------------------------------- /code/guess-range/guess-range-3.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | print("\n\nVocê terá de adivinhar um número que está dentro de uma faixa de valores! Que faixa é essa?\n") 4 | 5 | min_valor = int(input("Menor valor: ")) 6 | max_valor = int(input("Maior valor: ")) 7 | 8 | print("\n\nO computador vai pensar em um número de "+ str(min_valor) +" a "+ str(max_valor) 9 | +".\nTente adivinhar que número é esse!\nAtenção nas dicas!\n\n") 10 | 11 | max_tentativas = int(input("Quantas vezes quer tentar? ")) 12 | 13 | max_partidas = int(input("E quantas vezes você quer jogar? ")) 14 | 15 | numero_partidas = 0 16 | 17 | numero_acertos = 0 18 | 19 | while numero_partidas < max_partidas : 20 | 21 | numero_partidas = numero_partidas + 1 22 | 23 | print("\n(*) Partida " + str(numero_partidas)+"\n") 24 | 25 | resposta = randint(min_valor, max_valor + 1) 26 | 27 | acertou = False 28 | 29 | numero_tentativas = 0 30 | 31 | while numero_tentativas < max_tentativas: 32 | 33 | numero_tentativas = numero_tentativas + 1 34 | 35 | print("=> Tentativa " + str(numero_tentativas)) 36 | 37 | tentativa = int(input("Qual o seu chute? ")) 38 | 39 | if (tentativa > resposta): 40 | print("Tente um número menor!\n") 41 | elif (tentativa < resposta): 42 | print("Tente um número maior\n") 43 | else: 44 | acertou = True 45 | break 46 | 47 | if acertou: 48 | numero_acertos = numero_acertos + 1 49 | print("\nVocê acertou!\n") 50 | else: 51 | print("\nSuas tentativas acabaram nesta partida!\n") 52 | 53 | print("\n\n(*) Você já jogou todas as partidas e acertou " + str(numero_acertos) + "!") 54 | --------------------------------------------------------------------------------