Answer:
star wars death star....
Modify the following code so that:
Make the pool start with a random number ([20, 30] inclusive) of coins.
Based on the number of the randomly generated coins at the beginning,
let the computer determine whether Player 1 or Player 2 will be the
winner based on the winning strategy (by printing out the winner).
After deciding the supposed winner and loser, let the computer play
out both of the roles. For the winner, the computer should be applying
the winning strategy; for the loser, the computer should generate a
random amount of coins while following all the rules of the game
Rules of the game:
a) The game starts with 22 coins in a common pool
b) The goal of the game is to take the last coin
c) Two players take turns removing 1, 2, or 3 coins from the pool
d) A player can NOT take more coins than remaining coins in the pool
e) After each turn, the judge announces how many coins remain in the
pool
f) When the last coin is taken, the judge announces the winner
turn=0 #turn=1 remaining coins-24 print(Take turns removing 1, 2, or 3 coins. ) print(You win if you take the last coin.)
Answer:
Explanation:
The following code makes all the necessary changes so that the game runs as requested in the question. The only change that was not made was making the number of coins random since that contradicts the first rule of the game that states that the game starts with 22 coins.
turn = 0
remaining_coins = 22
print("Take turns removing 1, 2, or 3 coins. ")
print("You win if you take the last coin.")
while remaining_coins > 0:
print("\nThere are", remaining_coins, "coins remaining.")
if turn % 2 == 0:
# Player1
taken_coins = int(input("Player 1: How many coins do you take?"))
turn += 1
else:
# Player2
taken_coins = int(input("Player 2: How many coins do you take?"))
turn += 1
if taken_coins < 1 or taken_coins > 3 or taken_coins > remaining_coins:
print("That's not a legal move. Try again. ")
print("\nThere are", remaining_coins, "coins remaining.")
if turn % 2 == 0:
# Player1
taken_coins = int(input("Player 1: How many coins do you take? "))
turn += 1
else:
# Player2
taken_coins = int(input("Player 2: How many coins do you take? "))
turn += 1
remaining_coins -= taken_coins
else:
remaining_coins -= taken_coins
if remaining_coins - taken_coins == 0:
print("No more coins left!")
if turn % 2 == 0:
print("Player 1 wins!")
print("Player 2 loses !")
else:
print("Player 2 wins!")
print("Player 1 loses!")
remaining_coins = remaining_coins - taken_coins
else:
continue
17
Select the correct answer.
What is the key length of each key in triple DES?
OA 168 bits
ОВ.
56 bits
128 bits
OD
256 bits
OE.
192 bits
Answer:
OB
Explanation:
bc i said lol
bc i said lol to be 128 bits
1. Add the following method to the Point class:
public double distance(Point other)
Returns the distance between the current Point object and the given other Point object. The distance between two points is equal to the square root of the sum of the squares of the differences of their x- and y-coordinates. In other words, the distance between two points (x1, y1) and (x2, y2) can be expressed as the square root of (x2 - x1)2 + (y2 - y1)2. Two points with the same (x, y) coordinates should return a distance of 0.0.
public class Point {
int x;
int y;
// your code goes here
}
2. Create a class called Name that represents a person's name. The class should have fields named firstName representing the person's first name, lastName representing their last name, and middleInitial representing their middle initial (a single character). Your class should contain only fields for now.
3. Add two new methods to the Name class:
public String getNormalOrder()
Returns the person's name in normal order, with the first name followed by the middle initial and last name. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "John Q. Public".
public String getReverseOrder()
Returns the person's name in reverse order, with the last name preceding the first name and middle initial. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "Public, John Q.".
4. Add the following method to the Point class:
public int quadrant()
Returns which quadrant of the x/y plane this Point object falls in. Quadrant 1 contains all points whose x and y values are both positive. Quadrant 2 contains all points with negative x but positive y. Quadrant 3 contains all points with negative x and y values. Quadrant 4 contains all points with positive x but negative y. If the point lies directly on the x and/or y axis, return 0.
public class Point {
private int x;
private int y;
// your code goes here
}
Answer:
Explanation:
The following code is written in Java and creates all of the methods that were requested in the question. There is no main method in any of these classes so they will have to be called from the main method and call one of the objects created method for the code to be tested. (I have tested it and it is working perfectly.)
class Point {
private int x, y;
public void Point(int x, int y) {
this.x = x;
this.y = y;
}
public double distance (Point other) {
double distance = Math.sqrt(Math.pow((other.x - this.x), 2) + Math.pow((other.y - this.y), 2));
return distance;
}
public int quadrant() {
if (this.x > 0 && this.y > 0) {
return 1;
} else if (this.x < 0 && this.y > 0) {
return 2;
} else if (this.x < 0 && this.y < 0) {
return 3;
} else if (this.x > 0 && this.y < 0) {
return 4;
} else {
return 0;
}
}
}
class Name {
String firstName, lastName;
char middleInitial;
public String getNormalOrder() {
String fullName = firstName + " " + middleInitial + " " + lastName;
return fullName;
}
public String getReverseOrder() {
String fullName = lastName + ", " + firstName + " " + middleInitial;
return fullName;
}
}
Assume the data link protocol used by NDAS has the following associated characteristics:
An 8-bit ASCII code is used. Each frame has a size (length) of 11936 bits. A half-duplex circuit with a speed of 1 million bits per second is used for transmission. There is a 30-millisecond turnaround time on the half-duplex circuit. Each frame contains 20 overhead (non-user-data) bytes. Assume that the probability of a frame requiring retransmission due to error in transmission is 1 percent. A millisecond is one-thousandth of a second. Also, 8 bits = 1 character = 1byte
Fill in the blanks
K= _________ bits per bytes
M=_________ bytes
C= _________ overhead bytes
Answer:
The transmission speed = 0.278 MB/s
Explanation:
K = 8 bits
M = 11936/8 bits = 1492 bits
transmission rate R = 1000000/ 8 = 125000 bps
overhead bytes C = 20
probability = 0.01
time T = 30 ms = 30 x10^-3 s
The data transmission speed formula = K(M-C)(1-p) / (M/R) + T
= 8( 1492 - 20)(0.99)/ (1492/125000) + 30 x10^-3
= 0.278 MB/s
Why would an organization need to be aware of the responsibilities of hosting
personal data in its platforms?
Answer:
Providing transparent services for platform customers. Following data protection regulations to avoid disruptions from lack of compliance.
Write a Python program (rainfall.py) to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. Then for each year, the program should ask twelve times, once for each month, for inches of rainfall for that month. At the end, , the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Your program should contain two functions:
(1) rainfall(year): This function takes in a year (integer) as a parameter, and returns two values (totalMonths and totalRainfall). In this function, you need to use nested loop. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for inches (float) of rainfall for that month. After all iterations, the function should return the number of months (totalMonths) and the total inches of rainfall (totalRainfall). (Submit for 4 points)
(2) __main__: In the main, you do the following: (Submit for 6 points)
a. Prompt the user to input the number of years. Reprompt the user if the number of years is 0 or less. Hint: use a while loop.
b. Call rainfall(year) and pass to it the value entered above.
c. Calculate the average based on the returned values from rainfall function.
d. Display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Answer:
def rainfall(year):
totalMonths = totalRainfall = 0
for y in range(year):
for month in range(12):
rainfall = float(input(f"Enter inches of rainfall for month #{month+1}: "))
totalRainfall += rainfall
totalMonths = year * 12
return totalMonths, totalRainfall
def __main__():
while True:
year = int(input("Enter the number of years: "))
if year > 0:
break
numberOfMonths, totalRainfall = rainfall(year)
averageRainFall = totalRainfall / numberOfMonths
print(f"\nTotal number of months: {numberOfMonths}")
print(f"The total inches of rainfall: {totalRainfall}")
print(f"The average rainfall per month for the entire period: {averageRainFall}")
if __name__ == '__main__':
__main__()
Explanation:
Create a function named rainfall that takes year as a parameter
Inside the function:
Create a nested for loop. The outer loop iterates for each year (The range is from 0 to year-1) and the inner loop iterates for each month of that year (The range is from 0 to 11). Inside the inner loop, ask the user to enter the rainfall for that month. Add the rainfall to the totalRainfall (cumulative sum)
When the loops are done, calculate the totalMonths, multiply year by 12
Return the totalMonths and totalRainfall
Inside the main:
Create a while loop that asks user to enter the number of years while it is greater than 0
Call the rainfall function, passing the year as parameter. Set the numberOfMonths and totalRainfall using the rainfall function
Calculate the averageRainFall, divide totalRainfall by numberOfMonths
Print the results
can someone write the answers pls :(?
Answer:
A: job sharing.
B: part-time working.
C: flexible hours.
D: compressed hours.
A: Payroll workers, Typing pool workers, Car production workers, Checkout operators, Bank workers
B: Website designers, Computer programmers, Delivery drivers in retail stores, Computer maintenance staff, Robot maintenance staff.
3: Can lead to unhealthy eating due to dependency on ready meals, Can lead to laziness, Lack of fitness/exercise, Manual household skills are lost.
4: Microprocessor controlled devices do much of the housework, Do not need to do many things manually, Do not need to be in the house when food is cooking, Do not need to be in the house when clothes are being washed, Can leave their home to go shopping/work at any time of the day, Greater social interaction/more family time, More time to go out/more leisure time/more time to do other things/work, Are able to do other leisure activities when convenient to them, Can encourage a healthy lifestyle because of smart fridges analysing food constituents, Do not have to leave home to get fit
Explanation:
I tried really hard to solve these. I hope this answers your questions. can you make me the brainliest, that all I ask since I answered it for you. Pleasure solving these. C:
Consider the regular expressions:
R1 = (01)* (0*1*) (10)
R2 = (101)* (01)*
R3 = (10) (01*)*(01)
R4 = 10(R2*)|R3
Recall that, for a list of regular expressions, the function getToken() returns the next token from the input that matches one of the regular expressions. If there is more than one match, the longest match is returned. If there is more than one longest match, the token with the longest match that appears first in the list is returned. If there is no match, ERROR is returned. If the function getToken() is called once on input 1000101, it will return:
a. R1
b. R2
c. R3
d. R4
e. ERROR
Answer:
c. R3
Explanation:
For R1;
there are 10 matches, after these 10 no matches occur again
for R2;
this also does not match more than 10 as we have in R1
for r3;
R3 has the longest match. Its matching can be done 1000101 times.
for r4;
The whole of r4 can be matched.
Error;
we cannot have an error because matches exist.
so in answer to this question we pick R3 as the solution because there are more than one longest march and the one returned in the list is that which appeared first. R3 came first
In this exercise we have to use computer knowledge to identify which is the correct sequence of code that best corresponds to the given question, in this way we have that the correct alternative is:
[tex]c. R3[/tex]
So analyzing the first alternative, we find;
For R1, there are 10 matches, after these 10 no matches occur again.
So analyzing the second alternative, we find;
For R2, this also does not match more than 10 as we have in R1
So analyzing the third alternative, we find;
R3 has the longest match. Its matching can be done 1000101 times.
So analyzing the fourth alternative, we find;
For R4, the whole of r4 can be matched.
So analyzing the fifth alternative, we find;
Error; we cannot have an error because matches exist.
So in answer to this question we pick R3 as the solution because there are more than one longest march and the one returned in the list is that which appeared first.
See more about computer at brainly.com/question/950632
what is the difference between the flip horizontal and the flip vertical option
Answer:
Flip horizontal: Flip around the vertical axis. Flip vertical: Flip around the horizontal axis.
Explanation:
hope this helps
Which three of the following statements are true about using a WYSIWYG editor?
You can preview the web page you’re creating, but it might appear very differently in a web browser.
After creating a web page, you need to inspect the code the editor generates for correctness.
You can write your own HTML code to create a web page.
You can modify the HTML code the editor generates.
You don’t need any knowledge of HTML to be able to create a web page.
Answer:
It would be 3
You can preview the web page you’re creating, but it might appear very differently in a web browser. You can modify the HTML code the editor generates. You don’t need any knowledge of HTML to be able to create a web page.
What is WYSIWYG editor?A WYSIWYG editor stands for "What You See Is What You Get" editor. It is a software application that allows users to create and design web pages without needing to know HTML or other coding languages.
The following are true statements about using a WYSIWYG editor:
You can preview the web page you're working on, but it may look very different in a browser.The HTML code generated by the editor can be modified.You do not need any HTML knowledge to create a web page.It is not always necessary to inspect the code generated by the editor for correctness after creating a web page, as the editor should ideally generate correct code.
Thus, while you can write your own HTML code to create a web page, this is not a feature unique to WYSIWYG editors.
For more details regarding WYSIWYG editors, visit:
https://brainly.com/question/31574504
#SPJ2
whats difference between DCE AND DTE serial interface
DCE stands for data circuit-terminating, data communications, or data carrier equipment - this is a modem or more generally, a line adapter.
DTE stands for data terminal equipment which generally is a terminal or a computer.
Basically, these two are the different ends of a serial line.
Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral device should she use?
A.
voice recognition
B.
microphone
C.
mouse
D.
compact disk
Write a program that would determine the day number in a non-leap year. For example, in a non-leap year, the day number for Dec 31 is 365; for Jan 1 is 1, and for February 1 is 32. This program will ask the user to input day and month values. Then it will display the day number day number corresponding to the day and month values entered assuming a non-leap year. (See part II to this exercise below).
Answer:
In Python:
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
day = int(input("Day: "))
month = input("Month: ")
ind = months.index(month)
numday = 0
for i in range(ind):
numday+=daymonths[i]
numday+=day
print(numday)
Explanation:
This initializes the months to a list
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
This initializes the corresponding days of each month to a list
daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]
This gets the day from the user
day = int(input("Day: "))
This gets the month from the user
month = input("Month: ")
This gets the index of the month entered by the user
ind = months.index(month)
This initializes the sum of days to 0
numday = 0
This adds up the days of the months before the month entered by the user
for i in range(ind):
numday+=daymonths[i]
This adds the day number to the sum of the months
numday+=day
This prints the required number of days
print(numday)
Note that: Error checking is not done in this program
Which option in a Task element within Outlook indicates that the task is scheduled and will be completed on a later
date?
O Waiting on someone else
O In Progress
O Not started
O Deferred
Answer: D: Deferred
Explanation:
took test
Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
101
133
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.
Code:
#include
#include // Enables use of rand()
#include // Enables use of time()
using namespace std;
int main() {
int seedVal = 0;
seedVal = 4;
srand(seedVal);
/* Your solution goes here */
return 0;
}
Answer:
Replace the comment with:
cout<<100 + rand() % 49<<endl;
cout<<100 + rand() % 49<<endl;
Explanation:
To generate random number from min to max, we make of the following syntax:
min + rand()%(max - min)
In this case:
[tex]min = 100[/tex]
[tex]max = 149[/tex]
So, we have:
100 + rand()%(149 - 100)
100 + rand()%49
To print the statements, make use of:
cout<<100 + rand() % 49<<endl;
cout<<100 + rand() % 49<<endl;
1. How important is e-mail communication to you? Why?
Answer:
Communicating by email is almost instantaneous, which enhances communications by quickly disseminating information and providing fast response to customer inquiries. It also allows for quicker problem-solving and more streamlined business processes.
Under which menu option of a word processing program does a star appear?
A star appears under the
menu of the word processing program.
Answer:
shapes
Explanation:
Plato got it correctly
How should you schedule a meeting with someone in another time zone?
If you know what timezone they're in, try to work out what time in your own timezone your free, then tell the other person to do the same. Tell them what times in your timezone and the other can search up what the time is in their own timezone. If there is a specific time when you are both free, use that.
Ex:
You live in the U.S. but you have a meeting with someone in the U.K. You're only free at 4:00pm-6:00pm and they're only free from 10:00am-11:00am. 11:00am in England is 4:00pm in the U.S. so do at that time!
Hope this helps!
Consider any tasks performed in real life, for example, driving a taxi. The task you pick involves many functions. Driving a taxi involves picking up customers, and quickly and safely transporting them to their destination. Go through the components of the AI cycle to automate the problem you choose. List the useful precepts available. Describe how you will represent your knowledge. Based on that, describe how you will use reasoning to make and execute a plan expected to achieve a goal or obtain maximum utility. (this is for artificial intelligence, but they did not have that option)
U $ er Ideas for R 0 B 1 0 X?
Answer:
umm huh
Explanation:
english please
Answer:
i play ro blox add me wwekane9365
Explanation:
You can Hyperlink by:
Question 5 options:
Press CTRL+K (shortcut)
Go to Insert tab, Link Group, Click on Link Icon
Right click on a word / shape / picture and choose Link
All of the above /
Answer:
All of the above
Explanation:
I tryed them all
Give me good answers
1- what is the money?
2- what is the wealth?
How can it be used for good
Answer:
Money is currency
Explanation:
Is is how you pay for items
Which of the following statements is false?
Copyright exists the moment a work is created.
Copyright protects intellectual property such as text, art, film, music, or software.
Omitting the © copyright symbol means your work is not copyrighted.
Copyright is free.
You are not required to register your copyright.
It is false that omitting the © copyright symbol means your work is not copyrighted. The correct option is C.
What is a copyright?Original works of authorship are protected by copyright, a type of intellectual property, as soon as the author fixes the work in a tangible form of expression.
The creators of the works of expression typically control the copyrights, however there are some significant exceptions: When an employee produces a work while employed, the employer is the rightful owner of the copyright.
Some individuals think that a work isn't covered by copyright law if it doesn't display a copyright emblem. That is untrue. The copyright symbol need not be used in most situations.
Thus, the correct option is C.
For more details regarding a copyright, visit:
https://brainly.com/question/14704862
#SPJ2
hy plzz help me friends
Answer:
Ok so RAM is Random-Access-Memory.
RAM can store data just like in a hard drive - hdd or solid state drive - ssd
but the thing is that ram is really fast and data is only stored when RAM chips get power. On power loss your all data will be lost too.
ROM thanslates to Read-Only-Memory - so data in ROM chips can't be modifyed computer can just read the data but not write.
Read-only memory is useful for storing software that is rarely changed during the life of the system, also known as firmware.
Have a great day.
Explanation:
Answer:
Ram which stands for random access memory, and Rom which stands for read only memory are both present in your computer. Ram is volatile memory that temporarily stores the files you are working on. Rom is non-volatile memory that permanently stores instructions for your computer
what are the importance of web browser
Answer:
Web browser helps to access www.
Explanation:
A web browser is a software program that acts as a person's portal and portal to the Internet. It's easy to forget the browser's value now that it's so popular in our everyday lives. Users had to download software only to talk, watch videos, or play music until web browsers were invented.
A colleague has written a section of the main body of the same financial report. He has a long paragraph with lots of numbers. You suggest that he make this section easier to read by adding _____.
graphics
a reference
columns
a table
Answer:
a table
Explanation:
Answer: a table
Explanation:
2. How has the internet changed the way that people get news?
Answer:
Explanation:
you can access news from anywhere and know what is going on
Answer:
Most of the news is fact due to the ablilty of anybody can make it
Explanation:
For her homework, Annie has added the picture of a fruit in a document. She wants to enhance it to give a cut-out look. Which feature or menu option should she use?
Answer: See explanation
Explanation:
Since we are given the information that Annie added the picture of a fruit in a document and wants to enhance it to give a cut-out, she can enhance her document's look by using clip art.
Clips art are simply used for designing and can be used in the illustration of a medium. In this case, the clip art can like a bitmap graphics which typically have a limited quality.
Answer:
Shapes
Explanation:
took the quiz
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements.
Answer:
Explanation:
The following is written in C++ and asks the user for inputs in both miles/gallon and dollars/gallon and then calculates the gas cost for the requested mileages using the input values
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
// distance in miles
float distance1 = 20.0, distance2 = 75.0, distance3 = 500.0;
float miles_gallon, dollars_gallon;
cout << "Enter cars miles/gallon: "; cin >> miles_gallon;
cout << "Enter cars dollars/gallon: "; cin >> dollars_gallon;
cout << "the gas cost for " << distance1 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance1 / miles_gallon << "$\n";
cout << "the gas cost for " << distance2 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance2 / miles_gallon << "$\n";
cout << "the gas cost for " << distance3 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance3 / miles_gallon << "$\n";
return 0;
}
. Which of these perform real-world activities such as eating, sleeping, walking, and running in virtual worlds?
Answer:
all
Explanation:
Answer:
avatars
Explanation: I just took the test