# Neverending Python Challenges Game!

 Aubree Keegan · August 27, 2014 I think that Bucky's challenges are really fun and they are helping me learn too, so here is an idea I just came up with.We will start with a programming challenge. As soon as a user completes that challenge, they will post the answer and also a challenge of their own! This way, we will always have a new problem to work on.Here is my first one:Create a Python program that will complete this song:10 Green Bottles hanging on the wall10 Green Bottles hanging on the wallAnd if one Green Bottle should accidentally fallThere'll be 9 Green Bottles hanging on the wall9 Green Bottles hanging on the wall9 Green Bottles hanging on the wallAnd if one Green Bottle should accidentally fallThere'll be 8 Green Bottles hanging on the wall...Whoever answer first can post the next challenge!

## Replies

- page 2

 Nikola Pantelić · August 27, 2014 ``### alph is alphabet### sen is sentence### k is variable used to check if the character doesn't appear (1=char is in sentence,0=char is not in sentence)### I used sen.lower() to convert all characters to lower before comparing themalph="abcdefghijklmnopqrstuvwxyz"sen="The quick brown fox jumps over the lazy dog"k=0sen=sen.lower()for i in range(0,len(alph)):    for j in range(0,len(sen)):        while sen[j]==" ":            j+=1        if alph==sen[j]:            k=1            break    if k==0:        print("Sorry, sentence is not a pangram!")        exit(0)    k=0print("Sentence is pangram!")``Type a program that checks if the number is palindrome! Example: Numbers 1221 and 467764 are palindromes (they are same when you read them from behind) Yoncho Yonchev · August 27, 2014 ``from random import randintl=[2,3,4,5,6,7,8,9,10,'J','Q','K','A']n1,n2,n3,n4=randint(0,12),randint(0,12),randint(0,12),randint(0,12)def count_cards(n):   if n+2 <=10:      return n+2   else:      return 10print('Dealer has: ' +str(l[n1])+' '+str(l[n2])+'='+str(count_cards(n1)+count_cards(n2)))print('You have: ' +str(l[n3])+' '+str(l[n4])+'='+str(count_cards(n3)+count_cards(n4)))if (n1+n2) <(n3+n4):   print('You win!')else:   print('You loose!')``Program, that check is a sentence is panagram in English -> Example:"The quick brown fox jumps over the lazy dog" - contains all letters of the English alphabet. Ramanpreet Kaur · August 27, 2014 This works, but I am getting a warning for some reason  ``ramanpreet = ['Newton', 'House', 'Dog', 'Computer', 'Programming']ramanpreet.sort(key=len)print(ramanpreet)# output# ['Dog', 'House', 'Newton', 'Computer', 'Programming']``This is my warning:Expected type '(str) -> object | None' (matched generic type '(T) -> object | None'), got '(object: Sized) -> int' instead less... (Ctrl+F1) This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations. I don't understand what this means. Can anyone help? And it does work, so here is my next challenge. Create a simple program that randomly deals you and the dealer two cards each. The highest total wins! (the output should look like this)``Dealer has: K 7 = 17You have:   J 3 = 13You lose.`` Tommy Hillis · August 27, 2014 I got this!``fridays = 0for days in range(1, 366):    if days % 7 is 5:        print("Day", days, "is a Friday")        fridays += 1print("\nThere are", fridays, "Fridays this year!")``For the next challenge, let the user input any number, and print a start pyramid with that many rows. For example if they said 5:``    *   ***  ***** ****************`` Emily Cash · August 27, 2014 ``num = 10while num > 0:    print(num, "Green Bottles hanging on the wall")    print(num, "Green Bottles hanging on the wall")    print("And if one Green Bottle should accidentally fall")    num -= 1    print("There'll be", num, "Green Bottles hanging on the wall\n")``Next challenge: If a year (365 days) starts on a Monday, find out how many Fridays are in that year
• 1
• 2

## Python

130,058 followers