Question

In: Computer Science

python fill in these questions--- 1. Examine target_map.txt. Write a Python program that will read this...

python

fill in these questions---

1. Examine target_map.txt.

  • Write a Python program that will read this file, then compute and display the number of targets (#).
  • Copy your Python program below:

target_map.txt

S##.............................
..#.............................
...######.........##########....
........#..................#....
........#.................#.....
........#####.......######......
............#......#............
............#.......#...........
............#.......#...........
......#######.......#...........
......#.............#...........
......#..............###........
......#................#........
.......#...............#........
........#...............#.......
.........#.......#......#.......
.........#..............#.......
............#...........#.......
............#...#.......#.......
............#...#........#......
............#...#.........#.....
............#...#.........#.....
............#..........#........
............#..............#....
...##..#####....#..........#....
.#..............#...........#...
.#..............#...........#...
.#......#######............#....
.#.....#................#.......
.......#................#.......
..####.........#.....#..........
................######..........

Solutions

Expert Solution

Python code screenshot for the provided problem statement

target_map.txt

Program Output Screenshot


Related Solutions

Write a program in python to read from a file the names and grades of a...
Write a program in python to read from a file the names and grades of a class of students to calculate the class average, the maximum, and the minimum grades. The program should then write the names and grades on a new file identifying the students who passed and the students who failed. The program should consist of the following functions: a) Develop a getGrades() function that reads data from a file and stores it and returns it as a...
Write a python program that has: function createCustomerRecord that has 1 parameter, the filename to read...
Write a python program that has: function createCustomerRecord that has 1 parameter, the filename to read from, the method then reads all the records from the file and returns a dictionary. Each record in the file has the following format CivilIdNumber Name Telephone#     Address CivilIdNumber Name Telephone#     Address CivilIdNumber Name Telephone#     Address Etc A record always consists of 4 lines (civilid, name, telephone and address). You can find a sample input file on last page of this assignment, copy it...
Python program: Write a program that reads a text file named test_scores.txt to read the name...
Python program: Write a program that reads a text file named test_scores.txt to read the name of the student and his/her scores for 3 tests. The program should display class average for first test (average of scores of test 1) and average (average of 3 tests) for each student. Expected Output: ['John', '25', '26', '27'] ['Michael', '24', '28', '29'] ['Adelle', '23', '24', '20'] [['John', '25', '26', '27'], ['Michael', '24', '28', '29'], ['Adelle', '23', '24', '20']] Class average for test 1...
Step by step in python please Write a program this will read a file (prompt for...
Step by step in python please Write a program this will read a file (prompt for name) containing a series of numbers (one number per line), where each number represents the radii of different circles. Have your program output a file (prompt for name) containing a table listing: the number of the circle (the order in the file) the radius of the circle the circumference the area of the circle the diameter of the circle Use different functions to calculate...
Python DESCRIPTION Write a program that will read an array of integers from a file and...
Python DESCRIPTION Write a program that will read an array of integers from a file and do the following: ● Task 1: Revert the array in N/2 complexity time (i.e., number of steps) . ● Task 2: Find the maximum and minimum element of the array. INPUT OUTPUT Read the array of integers from a file named “ inputHW1.txt ”. To do this, you can use code snippet from the “ file.py ” file. This file is provided in Canvas....
Python DESCRIPTION Write a program that will read an array of integers from a file and...
Python DESCRIPTION Write a program that will read an array of integers from a file and do the following: ● Task 1: Revert the array in N/2 complexity time (i.e., number of steps) . ● Task 2: Find the maximum and minimum element of the array. INPUT OUTPUT Read the array of integers from a file named “ inputHW1.txt ”. To do this, you can use code snippet from the “ file.py ” file. This file is provided in Canvas....
Python DESCRIPTION Write a program that will read an array of integers from a file and...
Python DESCRIPTION Write a program that will read an array of integers from a file and do the following: ● Task 1: Revert the array in N/2 complexity time (i.e., number of steps) . ● Task 2: Find the maximum and minimum element of the array. INPUT OUTPUT Read the array of integers from a file named “ inputHW1.txt ”. To do this, you can use code snippet from the “ file.py ” file. This file is provided in Canvas....
Write a Python program to read in the temperatures for ten consecutive days in Celsius and...
Write a Python program to read in the temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and the entire array should be again be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted and the number of each...
Write a python program to read from a file the names and grades of a class...
Write a python program to read from a file the names and grades of a class of students to calculate the class average, the maximum, and the minimum grades. The program should then write the names and grades on a new file identifying the students who passed and the students who failed. The program should consist of the following functions: a) Develop a gradesInput() function that reads data from a file and stores it and returns it as a dictionary....
Goal: to write a Python program that will read a playlist from a CSV file and...
Goal: to write a Python program that will read a playlist from a CSV file and display it in the console in the form of a table. https://s3.eu-west-2.amazonaws.com/bb-python-modules/Coursework/CW3/playlist_text_question.html The following is a link to the question. It includes all instruction and a template file (with additional instructions) where the answer must be completed.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT