import sys
spam = ['apples', 'bananas', 'tofu', 'cats']
i = len(spam)
if len(spam) == 0:
    sys.exit
else:
    while i > 0:
        i = i-1
        print(spam[-i-1] + ',', end =" ")
        if i == 1:
            break
    print('and ' + spam[len(spam)-1])

8aae27b7e94b99213a0c1558c1c51a8658f000d1
<mask token>

<mask token>
if len(spam) == 0:
    sys.exit
else:
    while i > 0:
        i = i - 1
        print(spam[-i - 1] + ',', end=' ')
        if i == 1:
            break
    print('and ' + spam[len(spam) - 1])

<mask token>
spam = ['apples', 'bananas', 'tofu', 'cats']
i = len(spam)
if len(spam) == 0:
    sys.exit
else:
    while i > 0:
        i = i - 1
        print(spam[-i - 1] + ',', end=' ')
        if i == 1:
            break
    print('and ' + spam[len(spam) - 1])

import sys
spam = ['apples', 'bananas', 'tofu', 'cats']
i = len(spam)
if len(spam) == 0:
    sys.exit
else:
    while i > 0:
        i = i - 1
        print(spam[-i - 1] + ',', end=' ')
        if i == 1:
            break
    print('and ' + spam[len(spam) - 1])

import sys
spam = ['apples', 'bananas', 'tofu', 'cats']
i = len(spam)
if len(spam) == 0:
    sys.exit
else:
    while i > 0:
        i = i-1
        print(spam[-i-1] + ',', end =" ")
        if i == 1:
            break
    print('and ' + spam[len(spam)-1])
