Lukket

Write some program in Python

ollowing steps need to be performed:

Initialize a variable called number with a value of 10 and a variable called numAttempts with a value of 0

Ask the user for their name

Ask the user to guess a number between 1 and 20 and store that in a variable guess, increment the numAttempts variable

If guess is same as number then say your guess is correct and you guessed it in n attempt(s), where n is the value of numAttempts variable and your program ends.

If guess is lower than number then print "Your guess is too low". If numAttempts variable < 3, the goto step #7 else goto step #8.

If guess is higher than number then print "Your guess is too high". If numAttempts variable < 3, the goto step #7 else goto step #8

Repeat step #3 - #6.

If the user does not guess the number even after three attempts then print “Your three guesses are over, the number I was thinking of was 10”

Sample 1

Hello! What is your name?

Albert

Well, Albert, I am thinking of a number between 1 and 20.

Take a guess.

15

Your guess is too high.

Take a guess.

4

Your guess is too low.

Take a guess.

12

Your guess is too high. Your three guesses are over. The number I was thinking of was 10

Sample 2

Hello! What is your name?

Albert

Well, Albert, I am thinking of a number between 1 and 20.

Take a guess.

8

Your guess is too low.

Take a guess.

12

Your guess is too high.

Take a guess.

10

Good job, Albert! You guessed my number in 3 guesses!

Optional: Instead of fixing the number to be guessed to 10, you can initialize 'number' variable with a random number between 1 and 20 that you generate using the functions in the random module. This way every time you re run the program, it is a different number to be guessed.

____________________________________________________________________________________________________

Part - II (5 points)

Rock, Paper, Scissor:

Write a program to simulate the paper-rock-scissor game. Each of the two players type in P, R, or S. The program then announces the winner based on the rule: Paper covers Rock, Rock breaks Scissors, Scissors cut Paper, or Nobody wins. Be sure to allow the players to use lowercase as well as uppercase letters.

You MUST implement a function that takes the choices that both the players made and returns 1 if the player 1 won and 2 if the player 2 won and 0 if it is a tie. So the logic of deciding who won based on the rock, paper, scissor rule must be programmed inside this function.

You MUST call this function to decide who won and you must display the result of the game based on the return value of the function.

Sample run:

Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: P

Player 2: Please enter either (R)ock, (P)aper, or (S)cissors: s

Player 2 wins.

Optional: Your program can allow the users to play repeatedly say 5 times. Your program should then keep a score for each player and display that after each play.

Sample run (with optional part):

Player 1: Please enter either (R)ock, (P)aper, or (S)cissors: P

Player 2: Please enter either (R)ock, (P)aper, or (S)cissors: s

Player 2 wins.

Scores after this play:

Player 1: 0

Player 2: 1

Evner: PHP, Software Arkitektur

Se mere: write what i say, part time job python, write p, write my paper, winner takes, some program, scissors, R program, python game, need to write a program for, higher a write, albert, paper architecture, architecture paper, write function python, rock paper scissors program, paper cut, python function, function sample, tie software

Om arbejdsgiveren:
( 121 bedømmelser ) Calcutta, India

Projekt ID: #7070892

12 freelancere byder i gennemsnit ₹1491 på dette job

srinichal

I can deliver the program in python to your requirements .

₹5315 INR in 3 dage
(130 bedømmelser)
7.3
anuyadav1

A proposal has not yet been provided

₹1600 INR på 1 dag
(36 bedømmelser)
5.4
Fortut

A proposal has not yet been provided

₹1000 INR på 1 dag
(13 bedømmelser)
2.7
apacherai

hey I can do this but you have to approve the start first. Waiting for your reply ....ready to start right now.

₹2050 INR på 1 dag
(2 bedømmelser)
2.6
krvajal

Hi SIr, i can do this project foir u please open chat for details, i also have skills in python programming

₹1300 INR på 1 dag
(1 bedømmelse)
1.7
prateekchandan

Hi, I can do this task in say 30-40 minutes very easily. I have very good experience of python programming , you can look at my project [login to view URL] which is in python. Flere

₹650 INR in 0 dage
(1 bedømmelse)
1.1
bilaldd

Hi, I am a Python expert with 4 years of experience. And an MSc student working with Python. So I would like to do this well discripted easy job for you, if you would consider working with me. Bilal.

₹975 INR på 1 dag
(1 bedømmelse)
0.8
acetech2

Dear Client, Greeting of the day ahead !!! Thanks for providing us opportunity to place bid over the project and communicate with you. I am a serious bidder here and i have already worked on a similar project befor Flere

₹1300 INR på 1 dag
(1 bedømmelse)
0.0
aamarnath

I have completed masters degree in computer programming. I am ready to do your assignment. I can complete it within 3 hour. Please give me a chance

₹1050 INR på 1 dag
(0 bedømmelser)
0.0
Ronaldbe

I can do this job for you I can also provide a demo if required.

₹1150 INR in 2 dage
(0 bedømmelser)
0.0
sajidur1993

This task seems very easy and can do it in 1 or 2 hours. I am an expert in Python coding and have been coding in python for last 7 years. Once the task is given, I'll solve it in no time. Employer can message me for an Flere

₹650 INR in 0 dage
(0 bedømmelser)
0.0
lefatecpd

A proposal has not yet been provided

₹1300 INR på 1 dag
(0 bedømmelser)
0.0
ikosenn

Hello, I am a very experienced and passionate python developer. I have over 5 years experience. The challenge at hand is very simple and can be completed in an hour from hiring. I would like to assure you that the p Flere

₹600 INR på 1 dag
(0 bedømmelser)
0.0
verycooldad

I have finished this request ahead of time. I can send you the program upon payment. Please take this best option!

₹600 INR på 1 dag
(1 bedømmelse)
0.0