├── .gitattributes
├── Alan.py
├── Asal Sayı.py
├── Asal Sayılar.py
├── Binary.py
├── Celcius-Fahrenheit.py
├── DB Browser (SQLite).lnk
├── Database Yazdırma.py
├── Facebook.py
├── Fibonacci.py
├── Haber.py
├── Hava Durumu.py
├── Hızlı Yazma.py
├── Kriptografi.py
├── Max Min Ort.py
├── Pascal.py
├── Ping.py
├── README.md
├── SQL.py
├── Sezar Şifresi Kırma.py
├── Sezar Şifresi Oluşturma.py
├── TaşKağıtMakas.py
├── Text to Speech.py
├── Veritabanına Ekleme.py
├── YoutubeMP3.py
├── car.gif
├── database
├── database.db
├── eksikveriler.csv
├── eksikveriler.py
├── get-pip.py
├── guess.py
├── maze.py
├── memory.py
├── pacman.py
├── single_player_puzzle.py
├── snake.py
├── tron.py
├── Çarpma Öğrenme.py
├── Şekilli Şukullu.py
├── Şifre Oluşturucu.py
└── Şifre.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/Alan.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 |
3 | """
4 | Geometrik şekillerin alanlarını hesaplama
5 | """
6 |
7 |
8 | def kare(k):
9 | print("Karenin alanı = {}".format(k * k))
10 |
11 |
12 | def dikdortgen(k, u):
13 | print("Dikdörtgenin alanı = {}".format(k * u))
14 |
15 |
16 | def yamuk(a_t, u_t, y):
17 | print("Yamuğun alanı = {}".format(((a_t + u_t) * y) / 2))
18 |
19 |
20 | def paralelkenar(k, y):
21 | print("Paralel kenarın alanı = {}".format(k * y))
22 |
23 |
24 | def eskenardortgen(a_k, y_k):
25 | print("Eşkenar dörtgenin alanı = {}".format((a_k * y_k) / 2))
26 |
27 |
28 | if __name__ == '__main__':
29 | print("1 -Kare \n2 - Dikdörtgen\n3 - Yamuk\n4 - Paralelkenar\n5 - Eşkenar Dörtgen\n")
30 | secim = int(input("Alanını hesaplamak istediğiniz şekil: "))
31 |
32 | if secim == 1:
33 | k = int(input("Karenin bir kenarı: "))
34 | kare(k)
35 |
36 | elif secim == 2:
37 | k = int(input("Dikdörtgenin kısa kenarı: "))
38 | u = int(input("Dikdörtgenin uzun kenarı: "))
39 | dikdortgen(k, u)
40 |
41 | elif secim == 3:
42 | a = int(input("Yamuğun alt taban uzunuğu: "))
43 | u = int(input("Yamuğun üst taban uzunuğu: "))
44 | y = int(input("Yamuğun yüksekliği: "))
45 | yamuk(a, u, y)
46 |
47 | elif secim == 4:
48 | k = int(input("Paralel kenarın alt taban uzunluğu: "))
49 | y = int(input("Paralel kenarın yüksekliği: "))
50 | paralelkenar(k, y)
51 |
52 | elif secim == 5:
53 | a = int(input("Eşkenar dörtgenin alt kenar uzunluğu: "))
54 | y = int(input("Eşkenar dörtgenin yan kenar uzunluğu: "))
55 | eskenardortgen(a, y)
56 |
57 | else:
58 | print("Sadece belirtilen sayılardan birini giriniz.")
59 |
--------------------------------------------------------------------------------
/Asal Sayı.py:
--------------------------------------------------------------------------------
1 | sayac=0
2 | sayi=input('Sayı: ')
3 | for i in range(2,int(sayi)):
4 | if(int(sayi)%i==0):
5 | sayac+=1
6 | break
7 | if(sayac!=0):
8 | print("Sayı Asal Değil")
9 | else:
10 | print("Sayı Asal")
11 |
--------------------------------------------------------------------------------
/Asal Sayılar.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 |
3 | """
4 | Girdiğimiz bir sayıya kadar ki asal olan bütün sayıları listeleme
5 | """
6 |
7 | deger = int(input("Kaça kadar ki asal sayıları arıyorsunuz? : "))
8 | asal = []
9 |
10 | for i in range(2, deger):
11 | flag = False
12 | for j in range(2, i):
13 | if i % j == 0:
14 | flag = True
15 | break
16 | if not flag:
17 | asal.append(i)
18 |
19 | for i in asal:
20 | print(i)
21 |
22 | print("\n0 - {} arasında toplam {} tane asal sayı vardır.".format(deger, len(asal)))
23 |
--------------------------------------------------------------------------------
/Binary.py:
--------------------------------------------------------------------------------
1 | decimal = int(input("Number in decimal format: "))
2 |
3 | def binary(n):
4 | output = ""
5 | while n > 0:
6 | output = "{}{}".format(n % 2, output)
7 | n = n // 2
8 | return output
9 |
10 | # our method
11 | print(binary(decimal))
12 |
13 |
--------------------------------------------------------------------------------
/Celcius-Fahrenheit.py:
--------------------------------------------------------------------------------
1 | print("-" * 30)
2 | print("1- Celsius to fahrenheit")
3 | print("2- Fahrenheit to celsius")
4 | print("-" * 30)
5 |
6 | choice = input("Your choice (1/2): ")
7 |
8 | if choice == "1":
9 | print("\n# Celsius to Fahrenheit")
10 | celsius = float(input("Degree to convert: "))
11 | fahrenheit = (celsius * 1.8) + 32
12 | print("{} degree celsius is equal to {} degree fahrenheit.".format(celsius, fahrenheit))
13 | elif choice == "2":
14 | print("\n# Fahrenheit to Celsius")
15 | fahrenheit = float(raw_input("Degree to convert: "))
16 | celsius = (fahrenheit - 32) / 1.8
17 | print("{} degree fahrenheit is equal to {} degree celsius.".format(fahrenheit, celsius))
18 | else:
19 | print("Congratulations! You hacked the super-program.")
20 |
--------------------------------------------------------------------------------
/DB Browser (SQLite).lnk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aydinnyunus/Python-Kodlari/a66e5ca38db0c2fd8e4b55978eae64a57dc67e40/DB Browser (SQLite).lnk
--------------------------------------------------------------------------------
/Database Yazdırma.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 |
3 | vt=sqlite3.connect("database")
4 | im=vt.cursor()
5 |
6 |
7 | satırlar=im.execute("select ID,ADI,SOYADI,OKULNO FROM OGRENCI")
8 | for i in (satırlar):
9 | print(i)
10 |
11 |
12 |
13 |
14 |
15 | vt.commit()
16 | vt.close()
17 |
--------------------------------------------------------------------------------
/Facebook.py:
--------------------------------------------------------------------------------
1 | import webbrowser as sp
2 | sp.open("www.facebook.com")
3 |
--------------------------------------------------------------------------------
/Fibonacci.py:
--------------------------------------------------------------------------------
1 | def fibonacci(n, output=[]):
2 | a=1
3 | b=1
4 | for i in range(n):
5 | a, b = b, a + b
6 | output.append(str(a))
7 | return output
8 |
9 | number = int(input("Length of fibonacci sequence: "))
10 |
11 | print("Result: 1,{}".format(",".join(fibonacci(number))))
12 |
--------------------------------------------------------------------------------
/Haber.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 | # -*- coding: utf-8 -*-
3 |
4 | import feedparser
5 |
6 | """
7 | cnn'den son dakika haberlerini çekme
8 | """
9 | url = "http://www.cnnturk.com/feed/rss/news"
10 | haberler = feedparser.parse(url)
11 |
12 | i = 0
13 | for haber in haberler.entries:
14 | i += 1
15 | print(i)
16 | print(haber.title)
17 | print(haber.link)
18 | print(haber.summary)
19 | print("\n")
20 |
--------------------------------------------------------------------------------
/Hava Durumu.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 | import re
3 | import urllib.request
4 |
5 | url = "https://www.havadurumu15gunluk.net/havadurumu/istanbul-hava-durumu-15-gunluk.html"
6 | site = urllib.request.urlopen(url).read().decode('utf-8')
7 |
8 | r_gunduz = '
(-?\d+)°C | '
9 | r_gece = ' (-?\d+)°C | '
10 | r_gun = '(.*) | '
11 | r_tarih = '(.*) | '
12 | r_aciklama = '
(.*)'
13 |
14 | comp_gunduz = re.compile(r_gunduz)
15 | comp_gece = re.compile(r_gece)
16 | comp_gun = re.compile(r_gun)
17 | comp_tarih = re.compile(r_tarih)
18 | comp_aciklama = re.compile(r_aciklama)
19 |
20 | gunduz = []
21 | gece = []
22 | gun = []
23 | tarih = []
24 | aciklama = []
25 |
26 | for i in re.findall(r_gunduz, site):
27 | gunduz.append(i)
28 |
29 | for i in re.findall(r_gece, site):
30 | gece.append(i)
31 |
32 | for i in re.findall(r_gun, site):
33 | gun.append(i)
34 |
35 | for i in re.findall(r_tarih, site):
36 | tarih.append(i)
37 |
38 | for i in re.findall(r_aciklama, site):
39 | aciklama.append(i)
40 |
41 | print("-" * 75)
42 | print(" ISTANBUL HAVA DURUMU")
43 | print("-" * 75)
44 | for i in range(0, len(gun)):
45 | print("{} {},\n\t\t\t\t\tgündüz: {} °C\tgece: {} °C\t{}".format(tarih[i], gun[i], gunduz[i], gece[i], aciklama[i]))
46 | print("-" * 75)
47 |
--------------------------------------------------------------------------------
/Hızlı Yazma.py:
--------------------------------------------------------------------------------
1 | from datetime import *
2 |
3 | before = datetime.now()
4 |
5 | text = "Say hello to my little friend"
6 | print("Please type: {}".format(text))
7 |
8 | if text == input(": "):
9 | after = datetime.now()
10 |
11 | speed = after - before
12 | seconds = speed.total_seconds()
13 | letter_per_second = round(len(text) / seconds, 1)
14 |
15 | print("You won!")
16 | print("Your score is: {} seconds.".format(seconds))
17 | print("{} letters per second.".format(letter_per_second))
18 | else:
19 | print("You failed.")
20 |
--------------------------------------------------------------------------------
/Kriptografi.py:
--------------------------------------------------------------------------------
1 | def encrypt(text, value, output=""):
2 | for char in text:
3 | output = "{}{}".format(output, chr(ord(char) + value))
4 | return output
5 |
6 | def decrypt(text, value, output=""):
7 | for char in text:
8 | output = "{}{}".format(output, chr(ord(char) - value))
9 | return output
10 |
11 | i = int(input("Increment value: "))
12 |
13 | text = input("Type your text: ")
14 | print("Encrypted text: {}".format(encrypt(text, i)))
15 |
16 | text = input("\nType for decrypt: ")
17 | print("Decrypted text: {}".format(decrypt(text, i)))
18 |
--------------------------------------------------------------------------------
/Max Min Ort.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 |
3 | """
4 | Girilen sayılardan en büyük ve en küçük sayıları bulma
5 | """
6 |
7 | sayilar = []
8 |
9 | flag = True
10 | while flag:
11 | try:
12 | a = int(input("Sayıları girin(çıkış için -1): "))
13 | if a == -1:
14 | flag = False
15 | else:
16 | sayilar.append(float(a))
17 | except SyntaxError:
18 | print("HATA: Yalnızca sayı girin !")
19 | except NameError:
20 | print("HATA: Yalnızca sayı girin !")
21 |
22 | try:
23 | en_buyuk = sayilar[0]
24 | en_kucuk = sayilar[0]
25 | ortalama = sayilar[0]
26 | except IndexError:
27 | print("\nEn az bir sayı girmelisiniz")
28 | en_buyuk = "yok"
29 | en_kucuk = "yok"
30 | ortalama = "yok"
31 | finally:
32 | toplam = 0
33 |
34 | for sayi in sayilar:
35 | if sayi > en_buyuk:
36 | en_buyuk = sayi
37 | if sayi < en_kucuk:
38 | en_kucuk = sayi
39 | toplam += sayi
40 |
41 | ortalama = toplam / len(sayilar)
42 |
43 | print("\nen büyük sayı = {}\n" \
44 | "en küçük sayı = {}\n" \
45 | "ortalama = {}".format(en_buyuk, en_kucuk, ortalama))
46 |
--------------------------------------------------------------------------------
/Pascal.py:
--------------------------------------------------------------------------------
1 | def generate_pascal(height, rows=[]):
2 | rows.append([1])
3 | row=[1]
4 | for i in range(height):
5 | last = 0
6 | next_row = []
7 | for n in row:
8 | next_row.append(last + n)
9 | last = n
10 | next_row.append(1)
11 |
12 | row = next_row
13 | rows.append(row)
14 |
15 | return rows
16 |
17 | for i in generate_pascal(5):
18 | print (i)
19 |
--------------------------------------------------------------------------------
/Ping.py:
--------------------------------------------------------------------------------
1 | import subprocess as sp
2 |
3 | ip=input("Ip giriniz:")
4 | p=sp.Popen("ping "+ip,stdout=sp.PIPE)
5 |
6 | if p.poll():
7 | print(ip+"pasif")
8 | else:
9 | print(ip+"aktif")
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Python-Kodlari
2 |
3 | Python Projects
4 |
--------------------------------------------------------------------------------
/SQL.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 |
3 | vt=sqlite3.connect("database")
4 | im=vt.cursor()
5 |
6 |
7 | eski=input("Değiştirilecek ismi giriniz:")
8 | yeni=input("Yeni adı giriniz")
9 |
10 | im.execute("UPDATE OGRENCI SET ADI=? WHERE ADI=?",(yeni,eski))
11 |
12 |
13 | vt.commit()
14 | vt.close()
15 |
--------------------------------------------------------------------------------
/Sezar Şifresi Kırma.py:
--------------------------------------------------------------------------------
1 | print("Sezar Şifresi Kırma Programına Hoşgeldiniz.")
2 | sifresiz=input("Şifresi kırılacak metni giriniz:")
3 | def sifrele(metin):
4 | sifrelimetin=""
5 | for harf in metin:
6 | asciikod=ord(harf)
7 | asciikod=asciikod-3
8 | karakterkod=chr(asciikod)
9 | sifrelimetin=sifrelimetin+karakterkod
10 | print("Şifresiz:",metin,"Şifreli:",sifrelimetin)
11 |
12 | sifrele(sifresiz)
13 |
--------------------------------------------------------------------------------
/Sezar Şifresi Oluşturma.py:
--------------------------------------------------------------------------------
1 | def sifrele(metin):
2 | sifrelimetin=""
3 | for harf in metin:
4 | asciikod=ord(harf)
5 | asciikod=asciikod+3
6 | karakterkod=chr(asciikod)
7 | sifrelimetin=sifrelimetin+karakterkod
8 |
9 | print("Şifresiz:",metin,"Şifreli:",sifrelimetin)
10 | sifresiz=input("Şifrelenecek metni giriniz:")
11 | sifrele(sifresiz)
12 |
13 |
--------------------------------------------------------------------------------
/TaşKağıtMakas.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | print(("-" * 30) + "\nRock, Paper, Scissors\n" + ("-" * 30))
4 |
5 | user_score, computer_score = 0, 0
6 |
7 | while True:
8 | print("\n1 - Rock\n2 - Paper\n3 - Scissors")
9 | user_choice = input("Your choice: ")
10 | computer_choice = random.choice(["1", "2", "3"])
11 |
12 | if user_choice == "1" or "Rock":
13 | if computer_choice == "1":
14 | print("Computer's choice: Rock\nRock equal to rock. Scoreless!")
15 |
16 | elif computer_choice == "2":
17 | print("Computer's choice: Paper\nPaper wraps stone. You lose!")
18 | computer_score += 100
19 |
20 | elif computer_choice == "3":
21 | print("Computer's choice: Scissors\nRock breaks scissors. You win!")
22 | user_score += 100
23 |
24 | elif user_choice == "2" or "Paper":
25 | if computer_choice == "1":
26 | print("Computer's choice: Rock\nPaper wraps stone. You win!")
27 | user_score += 100
28 |
29 | elif computer_choice == "2":
30 | print("Computer's choice: Paper\nPaper equal to paper. Scoreless!")
31 |
32 | elif computer_choice == "3":
33 | print("Computer's choice: Scissors\nScissors cuts paper. You lose!")
34 | computer_score += 100
35 |
36 | elif user_choice == "3" or "Scissors":
37 | if computer_choice == "1":
38 | print("Computer's choice: Rock\nRock breaks scissors. You lose!")
39 | computer_score += 100
40 |
41 | elif computer_choice == "2":
42 | print("Computer's choice: Paper\nScissors cuts paper. You win!")
43 | user_score += 100
44 |
45 | elif computer_choice == "3":
46 | print("Computer's choice: Scissors\nScissors equal to scissors. Scoreless!")
47 |
48 | else:
49 | break
50 |
51 | print("\nUser's score: {}\nComputer's score: {}".format(user_score, computer_score))
52 |
--------------------------------------------------------------------------------
/Text to Speech.py:
--------------------------------------------------------------------------------
1 | from gtts import gTTS
2 | tts = gTTS(text="Hi", lang='tr')
3 | tts.save("audio1.mp3")
4 |
--------------------------------------------------------------------------------
/Veritabanına Ekleme.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 |
3 | vt=sqlite3.connect("database")
4 | im=vt.cursor()
5 | im.execute('''CREATE TABLE IF NOT EXISTS OGRENCI
6 | (ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
7 | ADI TEXT NOT NULL,
8 | SOYADI TEXT NOT NULL,
9 | OKULNO TEXT NOT NULL);''')
10 | ad=input("İsim:")
11 | soyad=input("Soyad:")
12 | okulno=input("Okul No:")
13 | veri=[]
14 | veri.append(ad)
15 | veri.append(soyad)
16 | veri.append(okulno)
17 |
18 | im.execute("INSERT INTO OGRENCI(ADI,SOYADI,OKULNO) VALUES (?,?,?)",veri)
19 | vt.commit()
20 | vt.close()
21 |
--------------------------------------------------------------------------------
/YoutubeMP3.py:
--------------------------------------------------------------------------------
1 | from pytube import YouTube
2 | yt = YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
3 |
4 |
--------------------------------------------------------------------------------
/car.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aydinnyunus/Python-Kodlari/a66e5ca38db0c2fd8e4b55978eae64a57dc67e40/car.gif
--------------------------------------------------------------------------------
/database:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aydinnyunus/Python-Kodlari/a66e5ca38db0c2fd8e4b55978eae64a57dc67e40/database
--------------------------------------------------------------------------------
/database.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aydinnyunus/Python-Kodlari/a66e5ca38db0c2fd8e4b55978eae64a57dc67e40/database.db
--------------------------------------------------------------------------------
/eksikveriler.csv:
--------------------------------------------------------------------------------
1 | ulke,boy,kilo,yas,cinsiyet
tr,130,30,10,e
tr,125,36,11,e
tr,135,34,10,k
tr,133,30,9,k
tr,129,38,12,e
tr,180,90,30,e
tr,190,80,25,e
tr,175,90,35,e
tr,177,60,22,k
us,185,105,33,e
us,165,55,27,k
us,155,50,44,k
us,160,58,,k
us,162,59,41,k
us,167,62,55,k
fr,174,70,47,e
fr,193,90,,e
fr,187,80,27,e
fr,183,88,28,e
fr,159,40,29,k
fr,164,66,32,k
fr,166,56,42,k
--------------------------------------------------------------------------------
/eksikveriler.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | Created on Thu Mar 15 04:18:20 2018
5 |
6 | @author: sadievrenseker
7 | """
8 |
9 | #kutuphaneler
10 | import numpy as np
11 | import matplotlib.pyplot as plt
12 | import pandas as pd
13 |
14 | #kodlar
15 | #veri yukleme
16 |
17 | veriler = pd.read_csv('eksikveriler.csv')
18 | #pd.read_csv("veriler.csv")
19 |
20 | print(veriler)
21 |
22 | #veri on isleme
23 | boy = veriler[['boy']]
24 | print(boy)
25 |
26 | boykilo = veriler[['boy','kilo']]
27 | print(boykilo)
28 |
29 | x = 10
30 |
31 | class insan:
32 | boy = 180
33 | def kosmak(self,b):
34 | return b + 10
35 |
36 | ali = insan()
37 | print(ali.boy)
38 | print(ali.kosmak(90))
39 |
40 |
41 | #eksik veriler
42 | #sci - kit learn
43 | from sklearn.preprocessing import Imputer
44 |
45 | imputer= Imputer(missing_values='NaN', strategy = 'mean', axis=0 )
46 |
47 | Yas = veriler.iloc[:,1:4].values
48 | print(Yas)
49 | imputer = imputer.fit(Yas[:,1:4])
50 | Yas[:,1:4] = imputer.transform(Yas[:,1:4])
51 | print(Yas)
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/guess.py:
--------------------------------------------------------------------------------
1 | """Guess a number within a range.
2 |
3 | Exercises
4 |
5 | 1. Change the range to be from 0 to 1,000,000.
6 | 2. Can you still guess the number?
7 | 3. Print the number of guesses made.
8 | 4. Limit the number of guesses to the minimum required.
9 |
10 | """
11 |
12 | from random import randint
13 | sayac=0
14 | while True:
15 | start = 1
16 | end = 100
17 | value = randint(start, end)
18 |
19 | print("I'm thinking of a number between", start, "and", end)
20 |
21 | guess = None
22 |
23 | while guess != value:
24 | text = input("Guess the number: ")
25 | guess = int(text)
26 | sayac=sayac+1
27 |
28 | if guess < value:
29 | print("Higher.")
30 | elif guess > value:
31 | print("Lower.")
32 |
33 | print("Congratulations! You guessed the right answer:", value)
34 | print(sayac,"attempts")
35 |
36 |
--------------------------------------------------------------------------------
/maze.py:
--------------------------------------------------------------------------------
1 | """Maze, move from one side to another.
2 |
3 | Excercises
4 |
5 | 1. Keep score by counting taps.
6 | 2. Make the maze harder.
7 | 3. Generate the same maze twice.
8 |
9 | """
10 |
11 | from turtle import *
12 | from random import random
13 | from freegames import line
14 |
15 | def draw():
16 | "Draw maze."
17 | color('black')
18 | width(5)
19 |
20 | for x in range(-200, 200, 40):
21 | for y in range(-200, 200, 40):
22 | if random() > 0.5:
23 | line(x, y, x + 40, y + 40)
24 | else:
25 | line(x, y + 40, x + 40, y)
26 |
27 | update()
28 |
29 | def tap(x, y):
30 | "Draw line and dot for screen tap."
31 | if abs(x) > 198 or abs(y) > 198:
32 | up()
33 | else:
34 | down()
35 |
36 | width(2)
37 | color('red')
38 | goto(x, y)
39 | dot(4)
40 |
41 | setup(420, 420, 370, 0)
42 | hideturtle()
43 | tracer(False)
44 | draw()
45 | onscreenclick(tap)
46 | done()
47 |
--------------------------------------------------------------------------------
/memory.py:
--------------------------------------------------------------------------------
1 | """Memory, puzzle game of number pairs.
2 |
3 | Exercises:
4 |
5 | 1. Count and print how many taps occur.
6 | 2. Decrease the number of tiles to a 4x4 grid.
7 | 3. Detect when all tiles are revealed.
8 | 4. Center single-digit tile.
9 | 5. Use letters instead of tiles.
10 |
11 | """
12 |
13 | from random import *
14 | from turtle import *
15 | from freegames import path
16 |
17 | car = path('car.gif')
18 | tiles = list(range(32)) * 2
19 | state = {'mark': None}
20 | hide = [True] * 64
21 |
22 | def square(x, y):
23 | "Draw white square with black outline at (x, y)."
24 | up()
25 | goto(x, y)
26 | down()
27 | color('black', 'white')
28 | begin_fill()
29 | for count in range(4):
30 | forward(50)
31 | left(90)
32 | end_fill()
33 |
34 | def index(x, y):
35 | "Convert (x, y) coordinates to tiles index."
36 | return int((x + 200) // 50 + ((y + 200) // 50) * 8)
37 |
38 | def xy(count):
39 | "Convert tiles count to (x, y) coordinates."
40 | return (count % 8) * 50 - 200, (count // 8) * 50 - 200
41 |
42 | def tap(x, y):
43 | "Update mark and hidden tiles based on tap."
44 | spot = index(x, y)
45 | mark = state['mark']
46 |
47 | if mark is None or mark == spot or tiles[mark] != tiles[spot]:
48 | state['mark'] = spot
49 | else:
50 | hide[spot] = False
51 | hide[mark] = False
52 | state['mark'] = None
53 |
54 | def draw():
55 | "Draw image and tiles."
56 | clear()
57 | goto(0, 0)
58 | shape(car)
59 | stamp()
60 |
61 | for count in range(64):
62 | if hide[count]:
63 | x, y = xy(count)
64 | square(x, y)
65 |
66 | mark = state['mark']
67 |
68 | if mark is not None:
69 | x, y = xy(mark)
70 | up()
71 | goto(x + 2, y)
72 | color('black')
73 | write(tiles[mark], font=('Arial', 30, 'normal'))
74 |
75 | update()
76 | ontimer(draw, 100)
77 |
78 | shuffle(tiles)
79 | setup(420, 420, 370, 0)
80 | addshape(car)
81 | hideturtle()
82 | tracer(False)
83 | onscreenclick(tap)
84 | draw()
85 | done()
86 |
--------------------------------------------------------------------------------
/pacman.py:
--------------------------------------------------------------------------------
1 | """Pacman, classic arcade game.
2 |
3 | Exercises
4 |
5 | 1. Change the board.
6 | 2. Change the number of ghosts.
7 | 3. Change where pacman starts.
8 | 4. Make the ghosts faster/slower.
9 | 5. Make the ghosts smarter.
10 |
11 | """
12 |
13 | from random import choice
14 | from turtle import *
15 | from freegames import floor, vector
16 |
17 | state = {'score': 0}
18 | path = Turtle(visible=False)
19 | writer = Turtle(visible=False)
20 | aim = vector(5, 0)
21 | pacman = vector(-40, -80)
22 | ghosts = [
23 | [vector(-180, 160), vector(5, 0)],
24 | [vector(-180, -160), vector(0, 5)],
25 | [vector(100, 160), vector(0, -5)],
26 | [vector(100, -160), vector(-5, 0)],
27 | ]
28 | tiles = [
29 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
30 | 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
31 | 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
32 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
33 | 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0,
34 | 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
35 | 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
36 | 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,
37 | 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
38 | 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0,
39 | 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0,
40 | 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
41 | 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
42 | 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0,
43 | 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0,
44 | 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
45 | 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
46 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
47 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49 | ]
50 |
51 | def square(x, y):
52 | "Draw square using path at (x, y)."
53 | path.up()
54 | path.goto(x, y)
55 | path.down()
56 | path.begin_fill()
57 |
58 | for count in range(4):
59 | path.forward(20)
60 | path.left(90)
61 |
62 | path.end_fill()
63 |
64 | def offset(point):
65 | "Return offset of point in tiles."
66 | x = (floor(point.x, 20) + 200) / 20
67 | y = (180 - floor(point.y, 20)) / 20
68 | index = int(x + y * 20)
69 | return index
70 |
71 | def valid(point):
72 | "Return True if point is valid in tiles."
73 | index = offset(point)
74 |
75 | if tiles[index] == 0:
76 | return False
77 |
78 | index = offset(point + 19)
79 |
80 | if tiles[index] == 0:
81 | return False
82 |
83 | return point.x % 20 == 0 or point.y % 20 == 0
84 |
85 | def world():
86 | "Draw world using path."
87 | bgcolor('black')
88 | path.color('blue')
89 |
90 | for index in range(len(tiles)):
91 | tile = tiles[index]
92 |
93 | if tile > 0:
94 | x = (index % 20) * 20 - 200
95 | y = 180 - (index // 20) * 20
96 | square(x, y)
97 |
98 | if tile == 1:
99 | path.up()
100 | path.goto(x + 10, y + 10)
101 | path.dot(2, 'white')
102 |
103 | def move():
104 | "Move pacman and all ghosts."
105 | writer.undo()
106 | writer.write(state['score'])
107 |
108 | clear()
109 |
110 | if valid(pacman + aim):
111 | pacman.move(aim)
112 |
113 | index = offset(pacman)
114 |
115 | if tiles[index] == 1:
116 | tiles[index] = 2
117 | state['score'] += 1
118 | x = (index % 20) * 20 - 200
119 | y = 180 - (index // 20) * 20
120 | square(x, y)
121 |
122 | up()
123 | goto(pacman.x + 10, pacman.y + 10)
124 | dot(20, 'yellow')
125 |
126 | for point, course in ghosts:
127 | if valid(point + course):
128 | point.move(course)
129 | else:
130 | options = [
131 | vector(5, 0),
132 | vector(-5, 0),
133 | vector(0, 5),
134 | vector(0, -5),
135 | ]
136 | plan = choice(options)
137 | course.x = plan.x
138 | course.y = plan.y
139 |
140 | up()
141 | goto(point.x + 10, point.y + 10)
142 | dot(20, 'red')
143 |
144 | update()
145 |
146 | for point, course in ghosts:
147 | if abs(pacman - point) < 20:
148 | return
149 |
150 | ontimer(move, 100)
151 |
152 | def change(x, y):
153 | "Change pacman aim if valid."
154 | if valid(pacman + vector(x, y)):
155 | aim.x = x
156 | aim.y = y
157 |
158 | setup(420, 420, 370, 0)
159 | hideturtle()
160 | tracer(False)
161 | writer.goto(160, 160)
162 | writer.color('white')
163 | writer.write(state['score'])
164 | listen()
165 | onkey(lambda: change(5, 0), 'Right')
166 | onkey(lambda: change(-5, 0), 'Left')
167 | onkey(lambda: change(0, 5), 'Up')
168 | onkey(lambda: change(0, -5), 'Down')
169 | world()
170 | move()
171 | done()
172 |
--------------------------------------------------------------------------------
/single_player_puzzle.py:
--------------------------------------------------------------------------------
1 | # Arda Mavi - ardamavi.com
2 | # 8-Puzzle
3 | import os
4 | import random
5 |
6 | # Ekranı temizleyen fonksiyonumuz:
7 | def clear_screen():
8 | os.system('clear')
9 | return
10 |
11 | class Tas:
12 | def __init__(self, lbl):
13 | self.lbl = lbl
14 | self.konum = lbl
15 |
16 | # Tasın Numarası:
17 | def getLbl(self):
18 | return self.lbl
19 |
20 | # Tasın Konumu:
21 | def getKonum(self):
22 | return self.konum
23 |
24 | # Tasın Konumunu Ayarlar:
25 | def setKonum(self, konum):
26 | self.konum = konum
27 |
28 | # Oluşturulan tablo çözülebilir mi:
29 | def solvable(rnd_list):
30 | count = 0;
31 | for i in range(0,len(rnd_list)):
32 | if rnd_list[i] == 0:
33 | continue
34 | for j in range(i+1,len(rnd_list)):
35 | if rnd_list[j] == 0:
36 | continue
37 | elif rnd_list[i]>rnd_list[j]:
38 | count = count+1
39 | if count%2 == 0:
40 | return True
41 | else:
42 | return False;
43 |
44 | # Taşlar oluşturulur:
45 | def taslar_olustur():
46 | taslar = []
47 | for i in range(0,9):
48 | taslar.append(Tas(i))
49 |
50 | # Tasların yerini rastgele yerlestir:
51 | rnd_list = []
52 | while 1:
53 | rnd_list = random.sample(range(9), 9)
54 | if solvable(rnd_list):
55 | break
56 |
57 | for tas in taslar:
58 | tas.setKonum(rnd_list[0])
59 | del rnd_list[0]
60 | return taslar
61 |
62 | # Tası bulur:
63 | def tas_bul(taslar, lbl = -1, konum = -1):
64 | for tas in taslar:
65 | if konum == -1:
66 | if tas.getLbl() == lbl:
67 | return tas
68 | else:
69 | if tas.getKonum() == konum:
70 | return tas
71 | return False # Tas Bulunamadı
72 |
73 | # Tasları Yazdır:
74 | def yazdir(taslar):
75 | tahta = '\n'
76 | for i in [0,3,6]:
77 | tahta += ' '
78 | for j in [0,1,2]:
79 | tas = tas_bul(taslar, konum = i+j)
80 | tas_lbl = str(tas.getLbl())
81 | if tas_lbl == '0':
82 | tas_lbl = ' '
83 | tahta += ' '+tas_lbl
84 | tahta += '\n'
85 | print(tahta)
86 | return
87 |
88 | # Hareket Ettirme:
89 | def hareket(taslar):
90 | bosTas = tas_bul(taslar, lbl = 0)
91 | switcher = {'w': +3, 'a': +1, 's': -3, 'd':-1}
92 | izin_list = ['w','a','s','d'] # W-A-S-D izin listesi
93 | if bosTas.getKonum() in [2,5,8]:
94 | izin_list = ['w','s','d']
95 | elif bosTas.getKonum() in [0,3,6]:
96 | izin_list = ['w','a','s']
97 | while 1:
98 | inpt = input('Hareket: ').lower()
99 | if inpt in izin_list:
100 | tas_konum = bosTas.getKonum()+switcher[inpt]
101 | tas = tas_bul(taslar, konum = tas_konum)
102 | if tas == False:
103 | clear_screen()
104 | print('Hatalı Giriş')
105 | yazdir(taslar)
106 | continue
107 | else:
108 | tas_bul(taslar, konum = tas_konum).setKonum(bosTas.getKonum())
109 | bosTas.setKonum(tas_konum)
110 | break
111 | elif inpt == 'q':
112 | return []
113 | else:
114 | clear_screen()
115 | print('Hatalı Giriş')
116 | yazdir(taslar)
117 | continue
118 | return taslar
119 |
120 | # Durum Kontrolu:
121 | def durum_kntl(taslar):
122 | for i in range(0,9):
123 | if tas_bul(taslar, konum = i).getLbl() is not i:
124 | return False
125 | return True
126 |
127 | # Oyun Başlar
128 | def oyun():
129 | taslar = taslar_olustur()
130 | while 1:
131 | clear_screen()
132 | yazdir(taslar)
133 | taslar = hareket(taslar)
134 | if taslar == []:
135 | clear_screen()
136 | print('Çıkış Yapıldı !')
137 | break
138 | if durum_kntl(taslar):
139 | clear_screen()
140 | yazdir(taslar)
141 | print('Tebrikler Oyunu Tamamladınız !')
142 | break
143 | return
144 |
145 | def main():
146 | clear_screen()
147 | print('8-Puzzle Oyunuma Hoş Geldiniz!\nArda Mavi - ardamavi\n')
148 | print('-- Oynanış --\nR -> Oyunu Başlat\nW-A-S-D -> Yön Tuşları\nQ -> Çık\n')
149 | secim = input('Seçim: ').lower()
150 | clear_screen()
151 | if secim == 'r':
152 | oyun()
153 | print('8-Puzzle\nArda Mavi - ardamavi\nProgramdan Çıkış Yapıldı')
154 | return
155 |
156 | if __name__ == '__main__':
157 | main()
158 |
--------------------------------------------------------------------------------
/snake.py:
--------------------------------------------------------------------------------
1 | """Snake, classic arcade game.
2 |
3 | Excercises
4 |
5 | 1. How do you make the snake faster or slower?
6 | 2. How can you make the snake go around the edges?
7 | 3. How would you move the food?
8 | 4. Change the snake to respond to arrow keys.
9 |
10 | """
11 |
12 | from turtle import *
13 | from random import randrange
14 | from freegames import square, vector
15 |
16 | food = vector(0, 0)
17 | snake = [vector(10, 0)]
18 | aim = vector(0, -10)
19 |
20 | def change(x, y):
21 | "Change snake direction."
22 | aim.x = x
23 | aim.y = y
24 |
25 | def inside(head):
26 | "Return True if head inside boundaries."
27 | return -200 < head.x < 190 and -200 < head.y < 190
28 |
29 | def move():
30 | "Move snake forward one segment."
31 | head = snake[-1].copy()
32 | head.move(aim)
33 |
34 | if not inside(head) or head in snake:
35 | square(head.x, head.y, 9, 'red')
36 | update()
37 | return
38 |
39 | snake.append(head)
40 |
41 | if head == food:
42 | print('Snake:', len(snake))
43 | food.x = randrange(-15, 15) * 10
44 | food.y = randrange(-15, 15) * 10
45 | else:
46 | snake.pop(0)
47 |
48 | clear()
49 |
50 | for body in snake:
51 | square(body.x, body.y, 9, 'black')
52 |
53 | square(food.x, food.y, 9, 'green')
54 | update()
55 | ontimer(move, 100)
56 |
57 | setup(420, 420, 370, 0)
58 | hideturtle()
59 | tracer(False)
60 | listen()
61 | onkey(lambda: change(10, 0), 'Right')
62 | onkey(lambda: change(-10, 0), 'Left')
63 | onkey(lambda: change(0, 10), 'Up')
64 | onkey(lambda: change(0, -10), 'Down')
65 | move()
66 | done()
67 |
--------------------------------------------------------------------------------
/tron.py:
--------------------------------------------------------------------------------
1 | """Tron, classic arcade game.
2 |
3 | Exercises
4 |
5 | 1. Make the tron players faster/slower.
6 | 2. Stop a tron player from running into itself.
7 | 3. Allow the tron player to go around the edge of the screen.
8 | 4. How would you create a computer player?
9 |
10 | """
11 |
12 | from turtle import *
13 | from freegames import square, vector
14 |
15 | p1xy = vector(-100, 0)
16 | p1aim = vector(4, 0)
17 | p1body = set()
18 |
19 | p2xy = vector(100, 0)
20 | p2aim = vector(-4, 0)
21 | p2body = set()
22 |
23 | def inside(head):
24 | "Return True if head inside screen."
25 | return -200 < head.x < 200 and -200 < head.y < 200
26 |
27 | def draw():
28 | "Advance players and draw game."
29 | p1xy.move(p1aim)
30 | p1head = p1xy.copy()
31 |
32 | p2xy.move(p2aim)
33 | p2head = p2xy.copy()
34 |
35 | if not inside(p1head) or p1head in p2body:
36 | print('Player blue wins!')
37 | return
38 |
39 | if not inside(p2head) or p2head in p1body:
40 | print('Player red wins!')
41 | return
42 |
43 | p1body.add(p1head)
44 | p2body.add(p2head)
45 |
46 | square(p1xy.x, p1xy.y, 3, 'red')
47 | square(p2xy.x, p2xy.y, 3, 'blue')
48 | update()
49 | ontimer(draw, 50)
50 |
51 | setup(420, 420, 370, 0)
52 | hideturtle()
53 | tracer(False)
54 | listen()
55 | onkey(lambda: p1aim.rotate(90), 'a')
56 | onkey(lambda: p1aim.rotate(-90), 'd')
57 | onkey(lambda: p2aim.rotate(90), 'j')
58 | onkey(lambda: p2aim.rotate(-90), 'l')
59 | draw()
60 | done()
61 |
--------------------------------------------------------------------------------
/Çarpma Öğrenme.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 | # -*- coding: utf-8 -*-
3 |
4 | from random import randint
5 |
6 | """
7 | Küçük çapta bir çarpım tablosu uygulaması
8 | """
9 |
10 | print("-" * 50)
11 | print("\t\tHOŞGELDİNİZ..")
12 | print("-" * 50, "\n")
13 |
14 |
15 | def carpim(i, j, r):
16 | if r != -1:
17 | if i * j == int(r):
18 | print("\t\t***** Doğru *****")
19 | else:
20 | print("\t!!! Yanlış cevap %s olacaktı" % (i * j))
21 | else:
22 |
23 | secim()
24 |
25 |
26 | def basla(rng_1, rng_2):
27 | if rng_1 > 10:
28 | x = 10
29 | else:
30 | x = 5
31 | for i in range(0, x):
32 | for j in range(0, x):
33 | sayi_1 = randint(rng_1, rng_2)
34 | sayi_2 = randint(rng_1, rng_2)
35 | print("_" * 50, "\n")
36 | print("\t%d x %d kaça eşittir? (çıkış = -1)" % (sayi_1, sayi_2))
37 | sonuc = input("sonuc >> ")
38 | carpim(sayi_1, sayi_2, sonuc)
39 |
40 | if i == 4 or j == 4:
41 | print("\n *-- Bu bölüm bitti bir üst bölüme geçebilsiniz --*\n")
42 | break
43 |
44 |
45 | def secim():
46 | print(" Hangi seviyeden başlamak istiyorsunuz (çıkış = -1) ?\n")
47 | print(" 1 - Kolay ")
48 | print(" 2 - Orta ")
49 | print(" 3 - Zor")
50 | print(" 4 - Çok zor\n")
51 |
52 | svy = int(input(" >> "))
53 |
54 | if svy == 1:
55 | basla(1, 6)
56 |
57 | if svy == 2:
58 | basla(6, 12)
59 |
60 | if svy == 3:
61 | basla(12, 25)
62 |
63 | if svy == 4:
64 | basla(25, 100)
65 |
66 | if svy == -1:
67 | exit(0)
68 |
69 |
70 | if __name__ == '__main__':
71 | secim()
72 |
73 | # @ozcanyarimdunya
74 |
--------------------------------------------------------------------------------
/Şekilli Şukullu.py:
--------------------------------------------------------------------------------
1 | import turtle
2 | colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']
3 | turtle.speed(100)
4 | t = turtle.Pen()
5 | turtle.bgcolor('black')
6 | for x in range(360):
7 | t.pencolor(colors[x%6])
8 | t.width(x/100 + 1)
9 | t.forward(x)
10 | t.left(59)
11 |
--------------------------------------------------------------------------------
/Şifre Oluşturucu.py:
--------------------------------------------------------------------------------
1 | import random
2 | import string
3 |
4 | def generate_password(length, level, output=[]):
5 | chars = string.ascii_letters
6 | if level > 1:
7 | chars = "{}{}".format(chars, string.digits)
8 | if level > 2:
9 | chars = "{}{}".format(chars, string.punctuation)
10 |
11 | for i in range(length):
12 | output.append(random.choice(chars))
13 |
14 | return "".join(output)
15 |
16 | print(("-" * 30) + "\n Password Generator\n" + ("-" * 30))
17 |
18 | password_length = int(input("Length: "))
19 | password_level = int(input("Level: "))
20 |
21 | password = generate_password(password_length, password_level)
22 | print("\nYour password is: {}".format(password))
23 |
--------------------------------------------------------------------------------
/Şifre.py:
--------------------------------------------------------------------------------
1 | """Crypto: tool for encrypting and decrypting messages.
2 |
3 | Exercises
4 |
5 | 1. Review 'ord' and 'chr' functions and letter-to-number mapping.
6 | 2. Explain what happens if you use key 26.
7 | 3. Find a way to decode a message without a key.
8 | 4. Encrypt numbers.
9 | 5. Make the encryption harder to decode.
10 |
11 | Adapted from code in https://inventwithpython.com/chapter14.html
12 |
13 | """
14 |
15 | def encrypt(message, key):
16 | "Encrypt message with key."
17 | result = ''
18 |
19 | # Iterate letters in message and encrypt each individually.
20 |
21 | for letter in message:
22 | if letter.isalpha():
23 |
24 | # Letters are numbered like so:
25 | # A, B, C - Z is 65, 66, 67 - 90
26 | # a, b, c - z is 97, 98, 99 - 122
27 |
28 | num = ord(letter)
29 |
30 | if letter.isupper():
31 | base = ord('A')
32 | elif letter.islower():
33 | base = ord('a')
34 |
35 | # The encryption equation:
36 |
37 | num = (num - base + key) % 26 + base
38 |
39 | result += chr(num)
40 |
41 | elif letter.isdigit():
42 |
43 | # TODO: Encrypt digits.
44 | result += letter
45 |
46 | else:
47 | result += letter
48 |
49 | return result
50 |
51 | def decrypt(message, key):
52 | "Decrypt message with key."
53 | return encrypt(message, -key)
54 |
55 | def decode(message):
56 | "Decode message without key."
57 | pass # TODO
58 |
59 | def get_key():
60 | "Get key from user."
61 | try:
62 | text = input('Enter a key (1 - 25): ')
63 | key = int(text)
64 | return key
65 | except:
66 | print('Invalid key. Using key: 0.')
67 | return 0
68 |
69 | print('Do you wish to encrypt, decrypt, or decode a message?')
70 | choice = input()
71 |
72 | if choice == 'encrypt':
73 | phrase = input('Message: ')
74 | code = get_key()
75 | print('Encrypted message:', encrypt(phrase, code))
76 | elif choice == 'decrypt':
77 | phrase = input('Message: ')
78 | code = get_key()
79 | print('Decrypted message:', decrypt(phrase, code))
80 | elif choice == 'decode':
81 | phrase = input('Message: ')
82 | print('Decoding message:')
83 | decode(phrase)
84 | else:
85 | print('Error: Unrecognized Command')
86 |
--------------------------------------------------------------------------------