Cat cafés

Report a typo

Kitty wants to visit a cat café! Help her find the one with the largest number of cats. It is guaranteed that all cafés have a different number of cats.

Input format

Each string contains a café's name followed by a space and the number of cats in it, e.g. Paws 11, Kittens 9.

The names would be one-word only. Read input lines until you get a string MEOW (without any number).

Output format

The café with the maximum number of cats.

Use the string's method split() to separate the name from the number. For example:
# The variable "cafe" is a string 'Paws 11'
cafe = string.split()
# Now the variable "cafe" is a list ['Paws', '11']

Note that the resulting list contains only strings: you better convert the number to an integer. You can access the elements this way:

name = cafe[0]  # first element
number = cafe[1]  # second element

You can use the method append() to add elements to the list. For example:

# the variable "names" is a list [11, 10]
names.append(12)
# now the variable "names" is a list [11, 10, 12] 

Sample Input 1:

Paws 11
Kittens 9
MEOW

Sample Output 1:

Paws
Write a program in Python 3





___

Create a free account to access the full topic