fb

Ads

Pages

How to Draw a love heart in python (With your name and your lover name)

The love heart I designed was made in Python which made it innovative and the best part is the code is very simple to understand. You can just edit this lines and make your own personalized love heart or you can even modify my idea and come up with a new idea all together. 


def valentine(person1,person2):
    leading_whitespace = range(0,4)[::-1] +[0]+range(0,8)
    inside = [3,5,14,14]+range(0,15)[::-1][::2]
    layers = ["  ___    ___",r" /   \  /   \ ",r'/     \/     \ ','|             |']
    for i in range(5,12):
        layers.append(' ' * leading_whitespace[i] + '\\' + ' ' * inside[i] + '/')
    #inserts person1 into layers[4]
    temp = []
    for char in layers[3]: temp.append(char)
    temp[1:len(person1)+1] = person1
    layers[3] = ''.join(temp)

    temp = []
    layers[4] = '|      +     |'

    # do that again for person2
    for char in layers[5]: temp.append(char)
    temp[-len(person2)-1:-1] = person2
    layers[5] = ''.join(temp)

    print '\n'.join(layers)

valentine('Your Name','Lover's Name')




3 comments:

echo 'bXlfbGlzdCA9IFsnJ10gKiAyNg0KZm9yIHlvIGluIHJhbmdlKDI2KToNCiAgICBmb3IgeCBpbiByYW5nZSgyNik6DQogICAgICAgIHkgPSB5byAtIHggLyAzDQogICAgICAgIG15X2xpc3RbMjUgLSB5b10gKz0gWycgJywgJysnXVsoeSoqMiAtIDIyKnkgKyAoeCoqMikgLyAzKSA8IDBdDQpwcmludCAnXG4nLmpvaW4oeFs6Oi0xXSt4IGZvciB4IGluIG15X2xpc3Qp' | base64 --decode | python


++ ++ ++ ++ ++ ++
+++++++++++++ +++++++++++++
++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++
++++++++++++++++++++++++
++++++++++++++++++++++
++++++++++++++++++
++++++++++++++++
++++++++++++
++++++

oops my output was not clear sorry about that. :)

I got syntax error in that command print '\n'.join(layers)

Post a Comment