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
seraphim [82]
3 years ago
13

You are making a game! The player tries to shoot an object and can hit or miss it. The player starts with 100 points, with a hit

adding 10 points to the player’s score, and a miss deducting 20 points. Your program needs to take 4 action results as input ("hit" or "miss"), calculate and output the player’s remaining points.
Computers and Technology
1 answer:
Anni [7]3 years ago
3 0

The program illustrates the use of loops and conditions.

Loops are used for repetitions, while conditions are used to make decisions

The game program in Python, where comments are used to explain each line is as follows:

#This initializes the point to 100

point = 100

#The following loop is repeated 4 times

for i in range(4):

   #This gets the current action

   action = input("Hit or Miss: ")

   #This following if statement calculates the point

   if action.lower() == "hit":

       point+=10

   else:

       point-=20

#This prints the calculated point

print(point)

Read more about loops and conditions at:

brainly.com/question/14284157

You might be interested in
With a ____ indent, all lines except the first line of the paragraph are indented from the left margin.
hoa [83]

The answer to this question is a hanging indent. A hanging indent is a writing format where in the first line of the text or paragraph is being aligned in the left margin. A hanging indent is also known as the hanging paragraph.  

3 0
4 years ago
When you block a number can they still text??
noname [10]
When a blocked number tries to send you a text message, it won’t go through, and they will likely never see the “delivered” note. On your end, you’ll see nothing at all. As far as phone calls are concerned, a blocked call goes directly to voice mail. On your end, you’ll get a special “blocked messages” folder in your voice mail inbox if they leave a message, but you won’t get a notification they called.
5 0
3 years ago
An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
erastovalidia [21]

2010s is the one who created the iPhone

8 0
3 years ago
Andy works for a TV broadcasting company. He needs to set up a network covering a small area on the work floor. However, he noti
katen-ka-za [31]
I believe it’s B)LAN

Explanation:
A LAN connects computers over a relatively short distance, allowing them to share data, files, and resources. For example, a LAN may connect all the computers in an office building, school, or hospital. Typically, LANs are privately owned and managed.
4 0
2 years ago
Each of the following code fragments contains a number of security vulnerabilities. For each fragment, identify these security v
Trava [24]

Answer:

Check the explanation

Explanation:

a)

1) int main(int argc, char *argv){

argv has always been an array of pointer whereby each and every element points to the command line argument that is passed to the program.

int main(int argc, char *argv[]) {

2) passwords = fopen(filePath, "r");

argv[0] always holds the name of the program currently running i.e. itself

So you shouldn't even try not to open a executable file for reading. since doing this will not give error but you won't be able to read the file as it is a binary file.

it is god to always check whether the file was opened successfully or not after opening the file. If file was not opened successfully fopen will return NULL.

passwords = fopen(filePath, "r");

if(passwords == NULL)

{

printf(“\n Unable to open file”);

return -1;

}

3) execl(shellPath, "shell", NULL);

Before making a call to execl you should close the open file

close(passwords);

b)

1) char itemID[9];

After creating a char array one should always initialize the array as it may contain some garbage value.

char itemID[9] = “”;

2) scanf("%d", &unitsOrdered);

Since unitOrdered represents the quantity, it should always be non zero and non negative

c)

1) char fullName[MAX_LEN];

MAX_LEN should not be zero or negative as it used to define the size.

If ( MAX_LEN <=0 )

{

return error;

}

else

{

char fullName[MAX_LEN]

}

2) strcpy(fullName, firstName);

Before using the string functions you're expected to always make sure that the pointer that you are passing to the functions should not be NULL i.e. the pointers should always pass to certain memory location.

if (firstName && lastName)

{

strcpy(fullName, firstName);

strcat(fullName, " ");

strcat(fullName, lastName);

return fullName;

}

else

{

return error;

}

5 0
3 years ago
Other questions:
  • What bug was supposed to start affecting computers on january 1 2000
    9·1 answer
  • Why dose this keep popping up will give brainlest for first person answer
    12·1 answer
  • Achieves integration through several different types of software that sit between and provide connectivity for two or more softw
    11·1 answer
  • Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new vi
    13·1 answer
  • As you are working on the Datacenter Edition server, you install a card to connect a set of RAID drives. After the card and driv
    8·1 answer
  • Write c++ program from 1to 100 to find prime numbers using statement.​​
    13·1 answer
  • When using the text command, what needs to be around the word or words you<br> want to appear?
    10·1 answer
  • Which keyboard shortcut would you press to copy cells that are selected in a spreadsheet?
    14·1 answer
  • What plugs into this?
    6·2 answers
  • What is the new subnet mask in prefix format?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!