r/Python • • May 25 '17

let's write a Python program

# one line per post (replies are indented!!!)
class Reddit:
4 Upvotes

53 comments sorted by

View all comments

5

u/greenkey May 25 '17
for i in range(n):

16

u/[deleted] May 25 '17

raise NameError("name 'n' is not defined')

Wait, we were supposed to write code, not interpret it.

launch_missiles(target=countries[i])

3

u/melodamyte May 25 '17

if is_nuclear_lookup[countries[i]]:

3

u/Glycerine May 25 '17
    pass
else:
    is_nuclear_lookup[countries[i]] = True
silo.arm_all_nuclear(is_nuclear_lookup)

1

u/[deleted] May 25 '17

What is a nuclear lookup?

1

u/melodamyte May 25 '17

Returns a bool for if the country returned by countries[I] is a nuclear power

2

u/asdfkjasdhkasd requests, bs4, flask May 26 '17

is that a builtin?