failed

I watched a rebroadcast of a certain anime yesterday, and when I noticed it in the morning, I made it, so I will post it.

program

letter.py


#coding:utf8
import random
miss = 'failed'
watashi = 'I'
watashi_num = 3
iteration = 40
I = [random.randint(0, iteration) for i in range(watashi_num)]
letter_string = ''

for i in range(iteration):
    if i in I:
        if I.index(i) == 0: letter_string += watashi
        else: letter_string += '\n' + watashi
    letter_string += miss

print letter_string[:-6]

output

Failed failed failed failed failed failed failed I failed failed failed failed failed failed failed failed failed
I failed failed failed failed failed failed failed failed failed failed
I failed failed failed failed failed failed failed failed failed failed failed failed failed

I played around with it, but it was an introduction of random as a tatemae. random.randint () returns an integer value from the first argument to the second argument at random.

Also, the reason why the last line is -6 is that you need 6 2 characters of'was'. So I didn't need the last two letters of "done" this time, so I erased it with a slice.

Recommended Posts

failed
phycopg2 installation failed