-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_extension.py
32 lines (27 loc) · 879 Bytes
/
test_extension.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Look up Pokémon by their index number.
Companion Python code to extend.c, which contains the underlying C code.
First try at extending Python with C.
Copyright (c) 2016 K Kollmann <code∆k.kollmann·moe>
"""
import pokemon_lookup as pi
# prompt for a number
print("Find a Pokémon based on its index number?")
print("Input YES or NO:")
choice = input()
if choice:
if choice.lower().startswith('y', 0, 1):
index = input("Enter a number to look up: ")
if index:
poke = pi.lookup_no(int(index))
print("Pokémon #{} is {}.".format(index, poke))
else:
print("Not a valid number.")
elif choice.lower().startswith('n', 0, 1):
pi.no_search()
else:
print("That... was not a valid choice.")
else:
print("No valid input, quitting program.")