(Python code 3.0)
I have been trying to make it that when you the number it will loop around, I tried this:
If guess==num: #this is randomly generated number
ask for yes or no the playagain
if answer==yes
replay=1
play_guess==0
if replay=1 play=("yes")
however this does not work, please could you suggest how I could accomplish this!

import random
import time
play_guess=("yes")
print("""                 Welcome to the game \"Crack the code!\"""")
print("""         The code has been set to a random number between 0 and 1000""")
print("""         Try and guess the code in the fewest attempts possible.""")
while play_guess==("yes"):
    turn=0
    difinput=input("""

                    -------------------------------
                   | Enter your chosen difficulty. |
                   |Easy,Medium,Unknown,Hard,Insane|
                    -------------------------------

                             Difficulty: """)
    diflock=0
    while True:
        if diflock>0:
            print("Foolish human, you think you can surpass my watertight code!")
            print("Type your chosen difficulty.")
            print("I will be watching your every move...")
        if difinput==("easy"):
            break
        if difinput==("medium"):
            break
        if difinput==("unknown"):
            break
        if difinput==("hard"):
            break
        if difinput==("insane"):
            break
        difinput=input("Difficulty: ")
        difinput.lower
        if difinput==("easy"):
            break
        if difinput==("medium"):
            break
        if difinput==("unknown"):
            break
        if difinput==("hard"):
            break
        if difinput==("insane"):
            break
        diflock+=1
    if difinput==("easy"):
        turnlimit=15
    elif difinput==("medium"):
        turnlimit=12
    elif difinput==("unknown"):
        turnlimit=random.randint(2,20)
    elif difinput==("hard"):
        turnlimit=9
    elif difinput==("insane"):
        turnlimit=6
    num=random.randint(0,1000)
    turn=0
    print("The game will now begin.")
    while turn < turnlimit:
        guess=None
        while not 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 in guess or guess==None:
            print("Enter your guess:")
            try:
                guess=int(input())
                if guess==num:
                    print("Congratulations, You have guessed the number!")
                    print("It has taken you",turn,"turns.")
                    print("Would you like to play again? <yes/no>")
                    playagaincheck=input("")
                    if playagaincheck==("yes"):
                        turn=0
                        play_guess=0
                        print("5..")
                        time.sleep(0.2)
                        print("4..")
                        time.sleep(0.2)
                        print("3..")
                        time.sleep(0.2)
                        print("2..")
                        time.sleep(0.2)
                        print("1..")
                        print("The game will now commence.")
                        play_guess=0
                    if playagaincheck==("no"):
                        print("Thankyou for playing")
                        play_guess=0
                        turn=0
                        break
                if turn==turnlimit:
                    print("Educated guessing is not you subject.")
                    print("Would you like to play again? <yes/no>")
                    playagaincheck=input("")
                    if playagaincheck==("yes"):
                        turn=0
                        play_guess=0
                        print("5..")
                        time.sleep(0.2)
                        print("4..")
                        time.sleep(0.2)
                        print("3..")
                        time.sleep(0.2)
                        print("2..")
                        time.sleep(0.2)
                        print("1..")
                        print("The game will now commence.")
                    else:
                        print("Thankyou for playing")
                        play_guess=0
                chancerem=turnlimit-turn
                turn+=1
                print("Turn:",turn)
                if not turn==turnlimit:
                    print("You have",chancerem-1,"chances remaining.")
                if num>guess:
                    print("Higher..")
                if num<guess:
                    print("Lower..")
                if 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 in guess:
                    break
            except ValueError:
                print("Foolish human, type an integer bewteen 0 and 1000.")

There is code snippet here in Daniweb by Gribouillis if you really want what your title says:
http://www.daniweb.com/software-development/python/code/260268

This statement is always True (same as 1)

>>> not 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9
True
>>> not 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 in (1,)
True
>>> not 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 in (0,)
True

So it is more clear to write:

while True:

Second part of condition does no difference as or short cuts on True.

Or this snippet .;)

while range(9) in guess:
       break
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.