Friday, 30 September 2016

Game of Rock Paper Scissors in Python

Rock Paper Scissors (Python)

import random
lst = ['rock','paper','scissors']
print "\n\n Rock, Paper and Scissors \n\n"
print "\n You are playing vs Computer\n"
user = raw_input("Enter yr name:")
while(True):

    user1 = raw_input("%s, do yo want to choose rock, paper or scissors?" % user)

    if user1 not in lst:
        print "Invalid Input(Please input exaclty words givne to choose)"
    computer = random.choice(lst)
    if user1 in lst:
        print 'Computer chooses', computer
    if computer == user1:
        print 'Its a Tie'
    if computer == 'rock' and user1 == 'paper':
        print '\n\n%s Wins\n\n' %user
    if computer == 'rock' and user1 == 'scissors':
        print '\n\nComputer Wins\n\n'
    if computer == 'paper' and user1 == 'rock':
        print '\n\nComputer Wins\n\n'
    if computer == 'paper' and user1 == 'scissors':
        print '\n\n%s Wins\n\n' %user
    if computer == 'scissors' and user1 == 'rock':
        print '\n\n%s Wins\n\n' %user
    if computer == 'scissors' and user1 == 'paper':
        print '\n\nComputer Wins\n\n'
    print 'Play again(yes/no)'
    user_play_again = raw_input('\nEnter(yes or no):\n')
    if user_play_again == 'yes':
        continue
    else:
         print '\n\nGame Over\n\n'

         break



OUTPUT:


Game of Rock Paper Scissors

Monday, 26 September 2016

Python Odd/Even Program

Program to check that the no. entered by user is odd/even. 

while(True):
    num = raw_input("Enter the number that you want to test for even/odd:\n")
    num = int(num)
    even_odd = num % 2
    if even_odd == 0:
        print "\n\nYour entered number is Even\n\n"
    else:
        print "\n\nYour entered number is Odd\n\n"


OUTPUT:


Thursday, 22 September 2016

How to install python 2.7 on windows???

Python Installation

1.  First of all download the python version 2.7 from here here  (Pythons 2.7 latest version is 2.7.12) .

2.Click on python 2.7.12

Python Installation

    .exe file will download on your pc/laptop.


3.  Click on the downloaded .exe file.

To be Cont.