Skip to content

Instantly share code, notes, and snippets.

@kubilaykaand
kubilaykaand / food.py
Last active September 11, 2021 18:57
Classic snake game, built with the Turtle( ) module, inside the library of "turtle" in Python.
from turtle import Turtle
import random
class Food(Turtle):
def __init__(self):
super().__init__()
self.refresh()
self.shape("circle")
self.penup()
self.shapesize(stretch_len=0.5, stretch_wid=0.5)
@kubilaykaand
kubilaykaand / slicing_example.py
Last active September 11, 2021 18:11
tuple and list slicing example
piano_keys=["a","b","c","d","e","f","g"]
piano_tuple=("do","re","mi","fa","so","la","ti")
print(piano_tuple[2:5])#example for tuple, ( ) while assigning, [] while manipulating
print(piano_keys[2:5:2])#example for list, [] while assigning, () while manipulating
print(piano_keys[::2])
print(piano_keys[::-1])