Created
August 30, 2016 14:42
-
-
Save sonerb/486d3e31f10521fc96a4e663794f1c74 to your computer and use it in GitHub Desktop.
baklava_dilimi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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