Respuesta :

Below is the code segement that opens the file and prints the average value of the integers.

Step-by-step coding:

# Check for an exception if file we cannot open file

try:    

file = open('numbers.txt', 'r')      

# Read from the file    

content = file.readlines()      

# Varaible for storing the sum      

sum = 0    

# Varaible for storing the count      

count = 0      

# Lets loop through the file contents      

for num in content:          

# Add this to our sum        

sum += int(num)          

count = count+1          

# calculate Average    

average = sum/count    

# Display average in console    

print("The average is:", average)  except ValueError:    

# Catch Exception while int conversion    

print("Exception: File does not contain all integers!")

except IOError:  

# Catch Exception while opening file  

print("Exception: Could not open file!")    

To learn more about Code in computer, visit: https://brainly.com/question/26683418

#SPJ4