Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#read random numbers from file import random try: f=open(C:/users/apple/Documents/randomnum2.txt,r #open file in read mode except FileNotFoundError as: print(file not found) count=0 try: for num in

#read random numbers from file import random try: f=open("C:/users/apple/Documents/randomnum2.txt","r" #open file in read mode except FileNotFoundError as: print("file not found") count=0 try: for num in f: print(num)#print the number count+=1 #increase the count except ValueError: print ("Value Error") f.close() #close the file print("Random number count: ",count-1) #print the count keeping getting syntax error message for the "except FilenotFound" help!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

What are the different types of cases?

Answered: 1 week ago

Question

1. Discuss the main incentives for individual employees.pg 87

Answered: 1 week ago