Question

SIGN_GROUPS = '[ARI,LEO,SAG]-[TAU,VIR,CAP]-[GEM,LIB,AQU]-[PIS,SCO,CAN]' def get_sign_group(sign): ''' (str) -> int Given a three character string representing a...

SIGN_GROUPS = '[ARI,LEO,SAG]-[TAU,VIR,CAP]-[GEM,LIB,AQU]-[PIS,SCO,CAN]'
def get_sign_group(sign):
    '''
    (str) -> int

    Given a three character string representing a star sign, return
    which group (out of 0, 1, 2, or 3) this star sign belongs to.

    Use the SIGN_GROUPS string (already defined for you above) to figure
    out the group.
    i.e. As given by this string '[ARI,LEO,SAG]-[TAU,VIR,CAP]-[GEM,LIB,AQU]-[PIS,SCO,CAN]'
         the signs ARI, LEO and SAG are in group 0, the signs TAU, VIR, CAP are in group 1,
         and so on.

    >>> get_sign_group('ARI')
    0

    >>> get_sign_group('CAN')
    3
    '''

Python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def get_sign_group(sign):
if sign in ['ARI','LEO','SAG']:
return 0
elif sign in ['TAU','VIR','CAP']:
return 1
elif sign in ['GEM','LIB','AQU']:
return 2
else:
return 3

Add a comment
Know the answer?
Add Answer to:
SIGN_GROUPS = '[ARI,LEO,SAG]-[TAU,VIR,CAP]-[GEM,LIB,AQU]-[PIS,SCO,CAN]' def get_sign_group(sign): ''' (str) -> int Given a three character string representing a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT