Neverending Python Challenges Game!

+11 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 wall
10 Green Bottles hanging on the wall
And if one Green Bottle should accidentally fall
There'll be 9 Green Bottles hanging on the wall

9 Green Bottles hanging on the wall
9 Green Bottles hanging on the wall
And if one Green Bottle should accidentally fall
There'll be 8 Green Bottles hanging on the wall

...


Whoever answer first can post the next challenge!  :happy:

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 Mason Farina · September 3, 2014

import random
userchoice = input("Please enter either rock, paper or scissors: ")
_enemyChoice = ["rock","paper","scissors"]
enemyChoice = _enemyChoice[random.randint(0,2)]
print("the computer chose: "+enemyChoice)
print("the player chose: "+userchoice)

if userchoice == "rock" and enemyChoice == "paper":
    print("the computer wins")
if userchoice== "rock" and enemyChoice== "rock":
    print("the it's a tie")
if userchoice== "rock" and enemyChoice== "scissors":
    print("the player wins")
if userchoice== "scissors" and enemyChoice== "rock":
    print("the computer wins")
if userchoice== "scissors" and enemyChoice== "scissors":
    print("its a tie")
if userchoice== "scissors" and enemyChoice== "paper":
    print("the computer wins")
if userchoice== "paper" and enemyChoice== "scissors":
    print("the computer wins")
if userchoice== "paper" and enemyChoice== "paper":
    print("its a tie")
if userchoice== "paper" and enemyChoice== "rock":
    print("the player wins")

Make a madlibs type game :)
+2 Samuel Oloruntoba · September 3, 2014
@jay, you did not ask a question, so i guess i can ask but since i don't know what madlibs are here is my own rock paper scissors solution, it is quite bulky but you can check it out at this url(https://github.com/kayandrae/BR-ROCK_PAPER_SCISSORS/blob/master/main.py) my own question is, a word is chosen from by the computer from a group of words, this particular word is mis-arranged, the user has 3 chances to spell the right word.
0 Bor GS · September 26, 2014
def narcissistic(n):
    digitlist=list(str(n))
    for i in range(len(digitlist)):
        digitlist = int(digitlist)
        digitlist **= len(digitlist)   
    if sum(digitlist) == n:
        return True
    else:
        return False

print(narcissistic(input()))

Type a program that checks if the number is prime.
0 Samuel Oloruntoba · September 26, 2014
def is_prime(num):
    prime = True 
    for i in range(2, num):
       if num % i == 0:
           prime = False
           break

    return prime
    
if is_prime(11):
    print('cool number')
else:
    print('this number sucks')

a simple function to check if a number is part of a fibonacci series.
0 Svante Nilsson · September 27, 2014

def Fibo(number):

    a = 0
    b = 1
    c = 0
    while number > c:
        c = a + b
        a = b
        b = c
    if number == c or number == 0:
        return True
    else:
        return False

print(Fibo(int(input("Enter your number:"))))


Bumping Jay's challenge:
"Create a running game where the player has to press 2 keys a certain number of times as if they were controlling legs and it times the time taken to 'run' the distance as well as somehow showing progress to the finish "
  • 1
  • 2

Python

128,234 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator