Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Russian Roulette

Hi guys! I always visit this forum because it is a great place to find project ideas and to learn some new things. Thought I would share a little script I made, it's a Russian Roulette script that asks the user for input, and if it is equal to the deadly number, then it just prints out a simple 'You lose.' I've coded something similar in PHP, except if you lose all the files on the server get deleted 🎉

Hope you guys like this script

Code
from random import randint

turns = 0 #counter for your number of turns

while turns != 5: #sets how many turns you get
    deadly_num = randint(0,9) #generates random number
    user_num = int(raw_input('Please input a number: ')) #user input #

    print user_num
    print deadly_num

    #print 'The number of turns is %d' % turns

    if user_num == deadly_num:
        print 'You lose'
        break
    turns = turns + 1
else:
    print 'You survived'
thanks for sharing, added to my collection of python script :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by SkunT3lloOct 20, 2021 04:24 AM 3 113 Oct 20, 2021 04:24 AM
Last Post: Lindros
[Java] by EthoJun 22, 2015 06:00 AM 6 114 Jun 22, 2015 06:00 AM
Last Post: badvibes
[.NET] by 1337GodDec 12, 2014 02:28 PM 11 442 Dec 12, 2014 02:28 PM
Last Post: i.Code