Challenges

Reddit challenges in python language.

Files Code and Result

challenge1_easy

challenge2_easy

challenge3_easy

challenge4_easy

challenge5_easy

challenge6_easy

challenge7_easy

challenge8_easy

challenge9_easy

challenge10_easy

challenge11.easy

challenge12_easy

challenge13_easy

challenge14_easy

challenge15_easy

challenge16_easy

challenge17_easy

challenge18_easy

challenge19_easy

challenge20_easy

challenge21_easy

challenge22_easy

challenge23_easy

challenge25_easy

challenge26_easy

challenge27_easy

challenge28_easy

challenge29_easy

challenge30_easy

challenge31_easy

challenge32_easy

challenge33_easy

challenge34_easy

challenge35_easy

challenge36_easy

challenge37_easy

challenge38_easy

challenge39_easy

challenge40_easy

challenge41_easy

challenge42_easy

challenge44_easy

challenge45_easy

challenge46_easy

challenge47_easy

challenge48_easy

challenge49_easy

challenge50_easy

challenge51_easy

challenge52_easy

challenge53_easy

challenge54_easy

challenge55_easy

challenge56_easy

challenge57_easy

challenge58_easy

challenge59_easy

challenge60_easy

challenge61_easy

challenge62_easy

challenge63_easy

challenge64_easy

challenge65_easy

challenge66_Dev

challenge66_easy

challenge67_easy

challenge68_easy

challenge69_easy

challenge69_easyBonus

challenge70_easy

challenge71_easy.py

challenge72_easy

challenge73_easy

challenge74_easy

challenge76_easy

challenge77_easy

challenge79_easy

challenge80_easyone

challenge82_easy

challenge83_easy

challenge86_easy

challenge94_easy

challenge104_easy

challenge130_easy

challenge143_easy

challenge146_easy

challenge148_easy

challenge149_easy

challenge153_easy

challenge154_easy

challenge158_easy

challenge158_easybonus

challenge159_easy

challenge160_easy

challenge169_easy

challenge169_easybonus

challenge172_easy

challenge174_easy

challenge175_easy

challenge177_easy

challenge180_easy

challenge181_easy

challenge185_easy

challenge192_easy

challenge193_easy

challenge197_easy

challenge198_easy

challenge199_easy

challenge201_easy

challenge202_easy

challenge203_easy

challenge204_easy

challenge204_easyBonus

challenge205_easy

challenge205_easyBonu

challenge206_easy

challenge208_easy

challenge210_easy

challenge211_easy

challenge212_easy

challenge212_easybonus

challenge213_easy

challenge214_easy

challenge215_easy

challenge216_easy

challenge217_easy

challenge218_easy

challenge218_easyBonus1

challenge218_easyBunus2

challenge219_easy

challenge220_easy.py

challenge221_easy

challenge221_easy

challenge222_easy

challenge222_easy.py

challenge223_easy

challenge226_easy

challenge226_easy

challenge228_easy.py

challenge228_easydev

challenge229_easy

challenge229_easybonus.py

challenge232_easy

challenge232_easy

challenge232_easybonus

challenge232_easybonus

challenge234_easy

challenge234_easybonus

challenge235_easy

challenge236_easy

challenge237_easy

challenge238_easy

challenge238_easybonus

challenge239_easy

challenge240_easy

challenge242_easy

challenge242_easy

challenge242_easyBonus

challenge243_easy

challenge245_easy

challenge245_easyBonus

challenge246_easy

challenge247_easy

challenge249_easy

challenge252_easy

challenge254_easy

challenge255_easy

challenge270_easy

challenge284_easy

challenge286_easy

challenge287_easy

challenge288_easy

challenge290_easy

challenge290_easybonus

challenge291_easy

challenge291_easybonus

challenge42_easy

''' Write a program that prints out the lyrics for "Ninety-nine bottles of beer",
"Old McDonald had a farm" or "12 days of Christmas".

If you choose "Ninety-nine bottles of beer", you need to spell out the number,
not just write the digits down. It's "Ninety-nine bottles of beer on the wall",
not "99 bottles of beer"!

For Old McDonald, you need to include at least 6 animals: a cow, a chicken, a turkey,
a kangaroo, a T-Rex and an animal of your choosing (Old McDonald has a weird farm).
The cow goes "moo", the chicken goes "cluck", the turkey goes "gobble", the kangaroo
goes "g'day mate" and the T-Rex goes "GAAAAARGH". You can have more animals if you like.

Make your code shorter than the song it prints out!

'''

cap_tens = ['Ninety', 'Eighty', 'Seventy', 'Sixty', 'Fifty', 'Forty', 'Thirty', 'Twenty']
lo_tens = ['ninety', 'eighty', 'seventy', 'sixty', 'fifty', 'forty', 'thirty', 'twenty']
teens = ['Nineteen', 'Eighteen', 'Seventeen', 'Sixteen', 'Fifteen', 'Fourteen', 'Thirteen', 'Twelve', 'Eleven', 'Ten' ]

digits = ['nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one', '']
digits2 = ['Nine bottles', 'Eight bottles', 'Seven bottles', 'Six bottles', 'Five bottles', 'Four bottles',
           'Three bottles', 'Two bottles', 'One bottle', 'no bottles']
nineteen = ['nineteen']

#-- ninety nine to twenty -----------------------------
for x in range(0, len(cap_tens)):
    for y in range(0, len(digits)):
        stock = cap_tens[x] + '-' + digits[y]

        if  x == 7 and y == 9:
            loss = nineteen[0]
        elif y == 9:
            stock = cap_tens[x]
            loss = lo_tens[x + 1] + '-' + digits[0]
        elif  y == 8:
            loss = lo_tens[x]
        elif y == 9:
            loss = lo_tens[x * 1] + '-' + digits[0]

        else:
            loss = lo_tens[x] + '-' + digits[y + 1]
        print(stock + ' bottles of beer on the wall. ' + stock + ' bottles of beer.')
        print('Take one down, pass it around, ' + loss + ' bottles of beer on the wall.')
        print()

#-- nineteen to ten -------------------------------
for x in range(0, len(teens)):
    stock = teens[x]
    if x == 9:
        loss = digits[0]
    else:
        loss = teens[x + 1]
    print(stock + ' bottles of beer on the wall. ' + stock + ' bottles of beer.')
    print('Take one down, pass it around, ' + loss + ' bottles of beer on the wall.')
    print()
#  nine to zero -----------------------------------
for x in range(0, len(digits2)):
    stock = digits2[x]
    if x == 9:
        loss = digits[0]
    else:
        loss = digits2[x + 1]
    print(stock + ' of beer on the wall. ' + stock + '  of beer.')
    print('Take one down, pass it around, ' + loss + ' of beer on the wall.')
    if loss == digits2[9]:
        exit()
    print()

Result

Ninety-nine bottles of beer on the wall. Ninety-nine bottles of beer.
Take one down, pass it around, ninety-eight bottles of beer on the wall.

Ninety-eight bottles of beer on the wall. Ninety-eight bottles of beer.
Take one down, pass it around, ninety-seven bottles of beer on the wall.

Ninety-seven bottles of beer on the wall. Ninety-seven bottles of beer.
Take one down, pass it around, ninety-six bottles of beer on the wall.

Ninety-six bottles of beer on the wall. Ninety-six bottles of beer.
Take one down, pass it around, ninety-five bottles of beer on the wall.

Ninety-five bottles of beer on the wall. Ninety-five bottles of beer.
Take one down, pass it around, ninety-four bottles of beer on the wall.

Ninety-four bottles of beer on the wall. Ninety-four bottles of beer.
Take one down, pass it around, ninety-three bottles of beer on the wall.

Ninety-three bottles of beer on the wall. Ninety-three bottles of beer.
Take one down, pass it around, ninety-two bottles of beer on the wall.

Ninety-two bottles of beer on the wall. Ninety-two bottles of beer.
Take one down, pass it around, ninety-one bottles of beer on the wall.

Ninety-one bottles of beer on the wall. Ninety-one bottles of beer.
Take one down, pass it around, ninety bottles of beer on the wall.

Ninety bottles of beer on the wall. Ninety bottles of beer.
Take one down, pass it around, eighty-nine bottles of beer on the wall.

Eighty-nine bottles of beer on the wall. Eighty-nine bottles of beer.
Take one down, pass it around, eighty-eight bottles of beer on the wall.

Eighty-eight bottles of beer on the wall. Eighty-eight bottles of beer.
Take one down, pass it around, eighty-seven bottles of beer on the wall.

Eighty-seven bottles of beer on the wall. Eighty-seven bottles of beer.
Take one down, pass it around, eighty-six bottles of beer on the wall.

Eighty-six bottles of beer on the wall. Eighty-six bottles of beer.
Take one down, pass it around, eighty-five bottles of beer on the wall.

Eighty-five bottles of beer on the wall. Eighty-five bottles of beer.
Take one down, pass it around, eighty-four bottles of beer on the wall.

Eighty-four bottles of beer on the wall. Eighty-four bottles of beer.
Take one down, pass it around, eighty-three bottles of beer on the wall.

Eighty-three bottles of beer on the wall. Eighty-three bottles of beer.
Take one down, pass it around, eighty-two bottles of beer on the wall.

Eighty-two bottles of beer on the wall. Eighty-two bottles of beer.
Take one down, pass it around, eighty-one bottles of beer on the wall.

Eighty-one bottles of beer on the wall. Eighty-one bottles of beer.
Take one down, pass it around, eighty bottles of beer on the wall.

Eighty bottles of beer on the wall. Eighty bottles of beer.
Take one down, pass it around, seventy-nine bottles of beer on the wall.

Seventy-nine bottles of beer on the wall. Seventy-nine bottles of beer.
Take one down, pass it around, seventy-eight bottles of beer on the wall.

Seventy-eight bottles of beer on the wall. Seventy-eight bottles of beer.
Take one down, pass it around, seventy-seven bottles of beer on the wall.

Seventy-seven bottles of beer on the wall. Seventy-seven bottles of beer.
Take one down, pass it around, seventy-six bottles of beer on the wall.

Seventy-six bottles of beer on the wall. Seventy-six bottles of beer.
Take one down, pass it around, seventy-five bottles of beer on the wall.

Seventy-five bottles of beer on the wall. Seventy-five bottles of beer.
Take one down, pass it around, seventy-four bottles of beer on the wall.

Seventy-four bottles of beer on the wall. Seventy-four bottles of beer.
Take one down, pass it around, seventy-three bottles of beer on the wall.

Seventy-three bottles of beer on the wall. Seventy-three bottles of beer.
Take one down, pass it around, seventy-two bottles of beer on the wall.

Seventy-two bottles of beer on the wall. Seventy-two bottles of beer.
Take one down, pass it around, seventy-one bottles of beer on the wall.

Seventy-one bottles of beer on the wall. Seventy-one bottles of beer.
Take one down, pass it around, seventy bottles of beer on the wall.

Seventy bottles of beer on the wall. Seventy bottles of beer.
Take one down, pass it around, sixty-nine bottles of beer on the wall.

Sixty-nine bottles of beer on the wall. Sixty-nine bottles of beer.
Take one down, pass it around, sixty-eight bottles of beer on the wall.

Sixty-eight bottles of beer on the wall. Sixty-eight bottles of beer.
Take one down, pass it around, sixty-seven bottles of beer on the wall.

Sixty-seven bottles of beer on the wall. Sixty-seven bottles of beer.
Take one down, pass it around, sixty-six bottles of beer on the wall.

Sixty-six bottles of beer on the wall. Sixty-six bottles of beer.
Take one down, pass it around, sixty-five bottles of beer on the wall.

Sixty-five bottles of beer on the wall. Sixty-five bottles of beer.
Take one down, pass it around, sixty-four bottles of beer on the wall.

Sixty-four bottles of beer on the wall. Sixty-four bottles of beer.
Take one down, pass it around, sixty-three bottles of beer on the wall.

Sixty-three bottles of beer on the wall. Sixty-three bottles of beer.
Take one down, pass it around, sixty-two bottles of beer on the wall.

Sixty-two bottles of beer on the wall. Sixty-two bottles of beer.
Take one down, pass it around, sixty-one bottles of beer on the wall.

Sixty-one bottles of beer on the wall. Sixty-one bottles of beer.
Take one down, pass it around, sixty bottles of beer on the wall.

Sixty bottles of beer on the wall. Sixty bottles of beer.
Take one down, pass it around, fifty-nine bottles of beer on the wall.

Fifty-nine bottles of beer on the wall. Fifty-nine bottles of beer.
Take one down, pass it around, fifty-eight bottles of beer on the wall.

Fifty-eight bottles of beer on the wall. Fifty-eight bottles of beer.
Take one down, pass it around, fifty-seven bottles of beer on the wall.

Fifty-seven bottles of beer on the wall. Fifty-seven bottles of beer.
Take one down, pass it around, fifty-six bottles of beer on the wall.

Fifty-six bottles of beer on the wall. Fifty-six bottles of beer.
Take one down, pass it around, fifty-five bottles of beer on the wall.

Fifty-five bottles of beer on the wall. Fifty-five bottles of beer.
Take one down, pass it around, fifty-four bottles of beer on the wall.

Fifty-four bottles of beer on the wall. Fifty-four bottles of beer.
Take one down, pass it around, fifty-three bottles of beer on the wall.

Fifty-three bottles of beer on the wall. Fifty-three bottles of beer.
Take one down, pass it around, fifty-two bottles of beer on the wall.

Fifty-two bottles of beer on the wall. Fifty-two bottles of beer.
Take one down, pass it around, fifty-one bottles of beer on the wall.

Fifty-one bottles of beer on the wall. Fifty-one bottles of beer.
Take one down, pass it around, fifty bottles of beer on the wall.

Fifty bottles of beer on the wall. Fifty bottles of beer.
Take one down, pass it around, forty-nine bottles of beer on the wall.

Forty-nine bottles of beer on the wall. Forty-nine bottles of beer.
Take one down, pass it around, forty-eight bottles of beer on the wall.

Forty-eight bottles of beer on the wall. Forty-eight bottles of beer.
Take one down, pass it around, forty-seven bottles of beer on the wall.

Forty-seven bottles of beer on the wall. Forty-seven bottles of beer.
Take one down, pass it around, forty-six bottles of beer on the wall.

Forty-six bottles of beer on the wall. Forty-six bottles of beer.
Take one down, pass it around, forty-five bottles of beer on the wall.

Forty-five bottles of beer on the wall. Forty-five bottles of beer.
Take one down, pass it around, forty-four bottles of beer on the wall.

Forty-four bottles of beer on the wall. Forty-four bottles of beer.
Take one down, pass it around, forty-three bottles of beer on the wall.

Forty-three bottles of beer on the wall. Forty-three bottles of beer.
Take one down, pass it around, forty-two bottles of beer on the wall.

Forty-two bottles of beer on the wall. Forty-two bottles of beer.
Take one down, pass it around, forty-one bottles of beer on the wall.

Forty-one bottles of beer on the wall. Forty-one bottles of beer.
Take one down, pass it around, forty bottles of beer on the wall.

Forty bottles of beer on the wall. Forty bottles of beer.
Take one down, pass it around, thirty-nine bottles of beer on the wall.

Thirty-nine bottles of beer on the wall. Thirty-nine bottles of beer.
Take one down, pass it around, thirty-eight bottles of beer on the wall.

Thirty-eight bottles of beer on the wall. Thirty-eight bottles of beer.
Take one down, pass it around, thirty-seven bottles of beer on the wall.

Thirty-seven bottles of beer on the wall. Thirty-seven bottles of beer.
Take one down, pass it around, thirty-six bottles of beer on the wall.

Thirty-six bottles of beer on the wall. Thirty-six bottles of beer.
Take one down, pass it around, thirty-five bottles of beer on the wall.

Thirty-five bottles of beer on the wall. Thirty-five bottles of beer.
Take one down, pass it around, thirty-four bottles of beer on the wall.

Thirty-four bottles of beer on the wall. Thirty-four bottles of beer.
Take one down, pass it around, thirty-three bottles of beer on the wall.

Thirty-three bottles of beer on the wall. Thirty-three bottles of beer.
Take one down, pass it around, thirty-two bottles of beer on the wall.

Thirty-two bottles of beer on the wall. Thirty-two bottles of beer.
Take one down, pass it around, thirty-one bottles of beer on the wall.

Thirty-one bottles of beer on the wall. Thirty-one bottles of beer.
Take one down, pass it around, thirty bottles of beer on the wall.

Thirty bottles of beer on the wall. Thirty bottles of beer.
Take one down, pass it around, twenty-nine bottles of beer on the wall.

Twenty-nine bottles of beer on the wall. Twenty-nine bottles of beer.
Take one down, pass it around, twenty-eight bottles of beer on the wall.

Twenty-eight bottles of beer on the wall. Twenty-eight bottles of beer.
Take one down, pass it around, twenty-seven bottles of beer on the wall.

Twenty-seven bottles of beer on the wall. Twenty-seven bottles of beer.
Take one down, pass it around, twenty-six bottles of beer on the wall.

Twenty-six bottles of beer on the wall. Twenty-six bottles of beer.
Take one down, pass it around, twenty-five bottles of beer on the wall.

Twenty-five bottles of beer on the wall. Twenty-five bottles of beer.
Take one down, pass it around, twenty-four bottles of beer on the wall.

Twenty-four bottles of beer on the wall. Twenty-four bottles of beer.
Take one down, pass it around, twenty-three bottles of beer on the wall.

Twenty-three bottles of beer on the wall. Twenty-three bottles of beer.
Take one down, pass it around, twenty-two bottles of beer on the wall.

Twenty-two bottles of beer on the wall. Twenty-two bottles of beer.
Take one down, pass it around, twenty-one bottles of beer on the wall.

Twenty-one bottles of beer on the wall. Twenty-one bottles of beer.
Take one down, pass it around, twenty bottles of beer on the wall.

Twenty- bottles of beer on the wall. Twenty- bottles of beer.
Take one down, pass it around, nineteen bottles of beer on the wall.

Nineteen bottles of beer on the wall. Nineteen bottles of beer.
Take one down, pass it around, Eighteen bottles of beer on the wall.

Eighteen bottles of beer on the wall. Eighteen bottles of beer.
Take one down, pass it around, Seventeen bottles of beer on the wall.

Seventeen bottles of beer on the wall. Seventeen bottles of beer.
Take one down, pass it around, Sixteen bottles of beer on the wall.

Sixteen bottles of beer on the wall. Sixteen bottles of beer.
Take one down, pass it around, Fifteen bottles of beer on the wall.

Fifteen bottles of beer on the wall. Fifteen bottles of beer.
Take one down, pass it around, Fourteen bottles of beer on the wall.

Fourteen bottles of beer on the wall. Fourteen bottles of beer.
Take one down, pass it around, Thirteen bottles of beer on the wall.

Thirteen bottles of beer on the wall. Thirteen bottles of beer.
Take one down, pass it around, Twelve bottles of beer on the wall.

Twelve bottles of beer on the wall. Twelve bottles of beer.
Take one down, pass it around, Eleven bottles of beer on the wall.

Eleven bottles of beer on the wall. Eleven bottles of beer.
Take one down, pass it around, Ten bottles of beer on the wall.

Ten bottles of beer on the wall. Ten bottles of beer.
Take one down, pass it around, nine bottles of beer on the wall.

Nine bottles of beer on the wall. Nine bottles  of beer.
Take one down, pass it around, Eight bottles of beer on the wall.

Eight bottles of beer on the wall. Eight bottles  of beer.
Take one down, pass it around, Seven bottles of beer on the wall.

Seven bottles of beer on the wall. Seven bottles  of beer.
Take one down, pass it around, Six bottles of beer on the wall.

Six bottles of beer on the wall. Six bottles  of beer.
Take one down, pass it around, Five bottles of beer on the wall.

Five bottles of beer on the wall. Five bottles  of beer.
Take one down, pass it around, Four bottles of beer on the wall.

Four bottles of beer on the wall. Four bottles  of beer.
Take one down, pass it around, Three bottles of beer on the wall.

Three bottles of beer on the wall. Three bottles  of beer.
Take one down, pass it around, Two bottles of beer on the wall.

Two bottles of beer on the wall. Two bottles  of beer.
Take one down, pass it around, One bottle of beer on the wall.

One bottle of beer on the wall. One bottle  of beer.
Take one down, pass it around, no bottles of beer on the wall.