专栏名称: AI报道
大数据时代,做数据的玩家!
目录
相关文章推荐
软件定义世界(SDX)  ·  李飞飞巴黎峰会开幕演讲:AI正自我觉醒!马克 ... ·  3 天前  
大数据分析和人工智能  ·  清华大学出品;75页ppt讲解DeepSee ... ·  昨天  
数据派THU  ·  NeurIPS 2024 | ... ·  2 天前  
CDA数据分析师  ·  Deepseek教我自学Python,貌似3 ... ·  3 天前  
51好读  ›  专栏  ›  AI报道

Python函数里的爱情故事

AI报道  · 公众号  · 大数据  · 2017-05-14 20:04

正文

来源:cizixs.com

链接:http://cizixs.com/2015/04/19/love-story-in-a-python-function



一直被拒型

  1. def my_love_story():

  2.    for girl in every_girl_I_liked:

  3.        response = declare_love(girl)

  4.        if response != "NO":

  5.            raise RunTimeError("There must be something wrong with the                 girl.")

孤单型

  1. def my_love_story():

  2.    return None

自己动手型

  1. def my_girl_friend():

  2.    return "Right Hand"

或者

  1. import random

  2. def my_girl_friend():

  3.    my_girl_friends = ["Left Hand", "Right Hand"]

  4.    return random.choice(my_girl_friends)

风流型

  1. def my_love_story():

  2.    for girl in every_girl_I_have_met:

  3.        sleep_with(girl)

一见钟情型

  1. def my_love_story():

  2.    assert love_at_first_sight(my_girl_friend) is True

钟爱一生型

  1. def my_love_story():

  2.    girl = met_a_girl()

  3.    girl_friend = dated_her(girl)

  4.    wife = got_married(girl_friend)

  5.    mother = had_a_child(wife)

  6.    assert girl is girl_friend is wife is mother

寻找真爱型

  1. def my_love_story():

  2.    girl = find_someone()

  3.    while not is_the_one(girl):

  4.        girl = find_someone()

  5.    live_happily_ever_after()

韩剧型

  1. def my_love_story():

  2.    assert me.is_wealthy()

  3.    assert me.is_handsome()

  4.    assert me.is_tall()

  5.    girl = someone_I_met_at_a_random_party()

  6.    me.hate(girl)

  7.    me. fell_in_love_with(girl)

  8.    girl.ex_boy_friend is jerk

  9.    me.fight(girl.ex_boy_friend)

  10.    me.date(girl)

  11.    me.mother.hate(girl)

  12.    me.mother.find_me_another_girl()

  13.    me.break_up_with_my_family()

  14.    girl.got_cancer()

  15.    me.is_devastated()

  16.    me.mother.give_money_to(me)

  17.    me.mother.accept(girl)

  18.    girl.is_cured()

  19.    me.kiss(girl)

  20.    the_end()

相亲型

  1. def my_love_story():

  2.    available_girls = filter(who_does_not_mind_my_poverty, girls_my_mother_set_me_up())

  3.    marry(biggest_boobs(available_girls))

现实型

  1. def my_love_story():

  2.    girl = met_a_girl()

  3.    girl_friend =







请到「今天看啥」查看全文