Answer :
A Python program that takes two integers as input from the user, representing number of hits and the number of misses for shooting a target:
def check_eligibility(precision_percentage):
if precision_percentage > 0.2:
print("Top Archers")
else:
print("Not Eligible")
The complete Python program:
```python
# Function to calculate the precision percentage
def calculate_precision(hits, misses):
total_shots = hits + misses
precision_percentage = hits / total_shots
return precision_percentage
# Function to check eligibility and display the result
def check_eligibility(precision_percentage):
if precision_percentage > 0.2:
print("Top Archers")
else:
print("Not Eligible")
# Main program
if __name__ == "__main__":
numHits = int(input("No of hits: "))
numMisses = int(input("No of misses: "))
precision = calculate_precision(numHits, numMisses)
print(f"Percentage: {numHits}/{numMisses + numHits} = {precision:.2f}")
check_eligibility(precision)
```
Sample Output:
```
No of hits: 20
No of misses: 50
Percentage: 20/70 = 0.29
Top Archers
```
In this program, the user is prompted to input the number of hits and misses. Then the precision percentage is calculated using the `calculate_precision` function. Finally, the eligibility is checked with the `check_eligibility` function, and the result is displayed accordingly.
Learn more about Python program from the given link:
https://brainly.com/question/28248633
#SPJ11
The program written using codes takes the number of hits and misses as input, calculates the precision percentage, and determines if the precision is above 0.2. It then displays the corresponding output message.
To write a program that calculates the precision percentage and checks if it is above 0.2, you can use the following code:
```python
numHits = int(input("Enter the number of hits: "))
numMisses = int(input("Enter the number of misses: "))
totalShots = numHits + numMisses
precision = numHits / totalShots
if precision > 0.2:
print("Top Archers")
else:
print("Not Eligible")
```
Here's how the code works:
1. First, we use the `input()` function to take the number of hits and misses as inputs from the user. The `int()` function is used to convert the inputs into integers.
2. We calculate the total number of shots by adding the number of hits and misses.
3. The precision percentage is calculated by dividing the number of hits by the total number of shots.
4. We use an `if` statement to check if the precision is greater than 0.2.
5. If the precision is above 0.2, it prints "Top Archers". Otherwise, it prints "Not Eligible".
For example, if the user enters 20 for hits and 50 for misses, the precision would be 20/70, which equals 0.4. Since 0.4 is greater than 0.2, the program would output "Not Eligible" in this case.
Therefore, this program takes the number of hits and misses as input, calculates the precision percentage, and determines if the precision is above 0.2. It then displays the corresponding output message.
Learn more about program from the below link:
https://brainly.com/question/23275071
#SPJ11