Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%
An error occurs when I try to run this python program. It states:
ERROR Exception Occured: '_io.TextIOWrapper' object has no attribute 'split'
I'm confused on how to fix this.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please help me with my Python code Im still getting errors like missing input data and more. def read_data(filename): try: with open(filename, "r") as file: return file.read() except Exception as exception: print("File is empty" if not str(exception) else str(exception)) return None def extract_data(tags, strings): data = [] start_tag = f"<{tags}>" end_tag = f"</{tags}>" while start_tag in strings: try: start_index = strings.find(start_tag) + len(start_tag) end_index = strings.find(end_tag) if end_index == -1: break value = strings[start_index:end_index] if value: data.append(value) strings = strings[end_index + len(end_tag):] except Exception as exception: print(exception) return data def get_names(string): names = extract_data("name", string) return names def get_descriptions(string):…arrow_forwardC++ You did this way back in Unit 1! But now all of your RomanNumber code is wrapped up in a class, so the "main" program is short and sweet. As before, write a program that accepts entries from the user. If it's an integer, convert to Roman Number and display. If it's a Roman Number, convert to integer and display. If it's neither, thrown an exception and continue to process The action to take here will be to display an error message If the entry is 0 or O (The digit 0 (zero) or the letter O) exit and state how many conversions were done of each type (integer to Roman and Roman to integer) and how many exceptions were thrown. As I said, the main program will be short and sweet. Provide your .cpp code and a screen shot of your program in action. Enter twelve conversions - four integer to Roman, four Roman to integer, and two of each in which the input is invalid so that I can see the exceptions. The thirteenth and final entry will be 0 or O.arrow_forwardplease fix the issue hihlighted in yellow and please check my code. In python language: Write a program that reads integers user_num and div_num as input, and output the quotient (user_num divided by div_num). Use a try block to perform all the statements. Use an except block to catch any ZeroDivisionError and output an exception message. Use another except block to catch any ValueError caused by invalid input and output an exception message. Note: ZeroDivisionError is thrown when a division by zero happens. ValueError is thrown when a user enters a value of different data type than what is defined in the program. Do not include code to throw any exception in the program. Ex: If the input of the program is: 15 3 the output of the program is: 5 Ex: If the input of the program is: 10 0 the output of the program is: Zero Division Exception: integer division or modulo by zero Ex: If the input of the program is: 15.5 5 the output of the program is: Input Exception: invalid literal for…arrow_forward
- This assignment is specifically designed to help you practice writing short Java programs and executing them at the command line. You are given a sample program and a description of what it is supposed to do. But there are errors, so you need to fix the errors and run the program. Start by launching a text editor, save the file as "Payroll.java" into your IST140 directory. Here is the code for your program (don't try to copy and paste, it will include unprintable characters and you will have errors when you compile): public class Payroll{ public static void main(String[] args) { double hrlyWage, hrsWorked, salary; hrlyWage 15.5; HrsWorked = 20; } } //Bug here salary hrlyWage + hrsWorked; // Bug here System.out.print("Salary: $" + salary); Save the file when you are done adding the code from above. Then, navigate back to the command window. Now if you type 'dir' on a windows machine (or Is on a mac), you should see the new file. Compile the new program using javac Payroll.java After it…arrow_forwardneed help with python. PLEASE PASTE UR WORKING AND INDENTED CODE HERE Implement the following: Request a color from the console. Print out the color in the format shown in the example output. Example OutputEnter your favorite color: blueBlue is a nice color.arrow_forwardWhat function handles the exception and why? (Python)arrow_forward
- in my code I am experiencing a problem with the inStack.peek() method. it is giving me an out of bounds exception "java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10" I have no idea why this is happening but i believe the problem is in the first for loop in the do while in the code. When the code goes through its second run of the do while loop it gives me the error message at the first instance of inStack.peek() method the comments explain what the code should do.please explain to me what the problem is in words not in code. queue is hidden due to character constraints. this is in java code. here is the code: MAIN FUNCTION import java.util.Scanner;import java.util.Random;public class test{public static void main(String[] Args){Scanner input = new Scanner(System.in); Random rand = new Random(); item maximum = new item(0, 0); stackX inStack; stackX outStack; queue discardQueue; item itemObj; System.out.println("please enter the size of the array");int…arrow_forwardThis is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. You also will use a file named DebugEmployeeIDException.java with the DebugTwelve4.java file. Code I was given- public class DebugEmployeeIDException extends Exception { public DebugEmployeeIDException() { super(s); } } // An employee ID can't be more than 999 // Keep executing until user enters four valid employee IDs // This program throws a FixDebugEmployeeIDException import java.util.*; public class DebugTwelve4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String inStr, outString = ""; final int MAX = 999; int[] emps = new int[4]; for(x = 0; x < emps.length; ++x) { System.out.println("Enter employee ID number"); inStr =…arrow_forwardnew java code can only be added after line 17.arrow_forward
- This code is only for python. this is a game- transfer rings there are 3 problems which you are solving: A: failed transfer - make sure the progam dont take more than what the user inputed by raising an exceptionB: codE the trade_money function C: if sonic doesnt have as much as the user inputed, there will be an error pop up 'ERROR TRADE FAILED'. make it so the progam can run normally rather than turning it down. CODE: class user:def __init__(self, name, initial_money):self.name = nameself.money = initial_moneydef give_money(self, amount):self.money = self.money + amountdef take_money(self, amount):# Part A: Raise an exception as appropriateself.money = self.money - amountdef print_users(users):total_money = 0for user in users:print(f'{user.name:s} has {user.money:d} rings')total_money = total_money + user.moneyprint(f'There are a total of {total_money:d} rings')# B: code the trade_money functionsonic = user('sonic', 80)tails = user('tails', 20)print_users([sonic,…arrow_forwardDesign and implement a program that creates an exception classcalled StringTooLongException, designed to be thrown when astring is discovered that has too many characters in it. In the maindriver of the program, read strings from the user until the userenters "DONE". If a string that has too many characters (say 20) isentered, throw the exception. Allow the thrown exception toterminate the programarrow_forwardin my code I am experiencing a problem with the inStack.peek() method. it is giving me an out of bounds exception "java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10" I have no idea why this is happening but i believe the problem is in the first for loop in the do while in the code. When the code goes through its second run of the do while loop it gives me the error message at the first instance of inStack.peek() method the comments explain what the code should do.please explain to me what the problem is in words not in code. queue is hidden due to character constraints. I have to use stacks and queues for this assignment no other data structure is allowed. is there any way to reset the stack to its original form? this is in java code. here is the code: MAIN FUNCTION import java.util.Scanner;import java.util.Random;public class test{public static void main(String[] Args){Scanner input = new Scanner(System.in); Random rand = new Random(); item maximum = new…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education