Skip to content

Instantly share code, notes, and snippets.

@sonerb
Created August 30, 2016 14:42
Show Gist options
  • Save sonerb/486d3e31f10521fc96a4e663794f1c74 to your computer and use it in GitHub Desktop.
Save sonerb/486d3e31f10521fc96a4e663794f1c74 to your computer and use it in GitHub Desktop.
baklava_dilimi.py
#coding:utf-8
def cizdir(boyut):
if boyut%2 == 0:
bosluk_sayi = int(boyut/2)-1
temp_bosluk_sayi = bosluk_sayi
for i in range(2,boyut,2):
my_str = ''
my_str += ' '*temp_bosluk_sayi
my_str += '*'*i
my_str += ' '*temp_bosluk_sayi
print(my_str)
temp_bosluk_sayi = temp_bosluk_sayi-1
temp_bosluk_sayi = temp_bosluk_sayi + 2
boyut = boyut - 2
for i in reversed(range(2,boyut,2)):
my_str = ''
my_str += ' '*temp_bosluk_sayi
my_str += '*'*i
my_str += ' '*temp_bosluk_sayi
print(my_str)
temp_bosluk_sayi = temp_bosluk_sayi+1
else:
bosluk_sayi = int(boyut/2)
temp_bosluk_sayi = bosluk_sayi
for i in range(1,boyut,2):
my_str = ''
my_str += ' '*temp_bosluk_sayi
my_str += '*'*i
my_str += ' '*temp_bosluk_sayi
print(my_str)
temp_bosluk_sayi = temp_bosluk_sayi-1
temp_bosluk_sayi = temp_bosluk_sayi + 2
boyut = boyut - 2
for i in reversed(range(1,boyut,2)):
my_str = ''
my_str += ' '*temp_bosluk_sayi
my_str += '*'*i
my_str += ' '*temp_bosluk_sayi
print(my_str)
temp_bosluk_sayi = temp_bosluk_sayi+1
cizdir(15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment