1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Thepotemich [5.8K]
3 years ago
15

PLZ HELP!!! I'm a beginner in coding!

Computers and Technology
1 answer:
Lina20 [59]3 years ago
4 0

import random

rock,paper,scissors = 1,2,3

choice = int(input("Please choose 1 2 or 3: "))

computer = random.randint(1,3)

player_won = False

draw = False

if choice == computer:

   draw = True

elif choice == 1 and computer == 3:

   player_won = True

elif choice == 2 and computer == 1:

   player_won = True

elif choice == 3 and computer == 2:

   player_won = True

if player_won:

   print("You won!")

elif not player_won and not draw:

   print("The computer won!")

else:

   print("It's a draw!")

First, I recommend importing at the beginning of your program. Also, you can combine all your same datatype variables in one line. You also need to cast your user choice to an integer so you can compare it with the computer's choice. I wrote the if, elif, and else statements using a boolean variable. I simply wrote all the possibilities that would result in the player winning and this would result in the player_won variable being true. If this is the case, we print to the console, "You won!"

You might be interested in
Use the drop-down menus to complete each statement. Two main versions of Outlook are the desktop app and the app. The has limite
maksim [4K]

Answer:

1) Mobile

2) Mobile app

3) Desktop

4) Is on the cloud

Explanation:

Ik its late for you but it'll hopefully help out others in the future

8 0
3 years ago
Read 2 more answers
What is the total utilization of a circuit-switched network, accommodating five users with equal bandwidth share, and the follow
VMariaS [17]

Answer: 49.0%

Explanation:

Given the total number of users = 5

Let the total bandwidth be 100 units

Each user share = 100/5 units = 20 units each

• 2 users are using 63% of their shared bandwidth:

This means 63% of 20 units = 0.63 *2*20 = 25.2

• 2 users are using 58% of their shared bandwidth:

This means 58% of 20 units = 0.58* 2* 20 = 23.2

• 1 user uses 3% of their bandwidth share:

This means 3% of 20 units = 0.03* 1* 20 = 0.6

Therefore, total amount of used bandwidth becomes = 25.2 + 23.2 + 0.6

Total bandwidth under usage = 25.2 + 23.2 + 0.6 = 49

Utilization becomes = (bandwidth under usage/ maximum bandwidth)*100

(49/100)*100 = 49%

I hope this helps, cheers.

4 0
3 years ago
Char[][] array1 = new char[15][10];
iragen [17]

Answer:The answer to this question is 15

Explanation:

array1.length contains the number of rows.Since a 2-D array is a 1-D array of 1-D arrays.So the value of array1.length will be 15 and the value of array1[0].length will be 10 that is the number of columns.So we conclude that the answer is 15 that is the number of the rows.

3 0
3 years ago
Based on the strength of the magnetic fields they produce, arrange the solenoids from strongest to weakest
Deffense [45]

Answer:

C, D, B and A.

Explanation:

Electromagnet in option C is strongest because it has an iron core and the largest current as compared to other solenoids, following by D and then B whereas solenoid A is the weakest because of the absence of an iron core and has the smallest current. Solenoid having iron core is the strongest solenoid because the core produces more strong magnetic field as compared to no iron core.

8 0
3 years ago
This toolbar can be used to change the way the text in your presentation looks. Drawing
jenyasd209 [6]
Most likely formatting

6 0
3 years ago
Read 2 more answers
Other questions:
  • Renting provides _________ flexibility but can lead to _________ costs in the long-term.
    14·2 answers
  • What is the primary benefit of using solid state storage
    7·1 answer
  • When Russ opened a website on his browser, he saw an error that the site was not compatible with the browser version he was runn
    9·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    9·1 answer
  • A quien se le conoce como el padre de la tecnologia?
    10·1 answer
  • A website for a certain political party or candidate is likely to have unbiased
    6·1 answer
  • when you sent email your email can be set to automatically keep a copy where do you find these copies​
    13·1 answer
  • Could some please answer the question in the pictures? Thank you!! I will also give your brainliest if you give me the right ans
    11·1 answer
  • how does the use of data abstraction manage complexity in program code? how does using lists make a program easier to develop an
    5·1 answer
  • Who invented Satellites? What purpose does it serve? How has it impacted society today?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!