Question

#Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4] # # Our Helper
# Sets the birthday of the record at the given index # Returns: nothing def setBirthday (records, index, newBirthday): 29 30
ta formats llenge: variable length records Search for the firstname F and lastname L. replacing the birthday with B.Write the
#Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4] # # Our Helper functions: # # Loads the file at filepath # Returns a 2d array with the data def load2dArrayFromFile (filepath): # Your code goes here: 1 2 23 # # Searches the 2d array 'records' for firstname, lastname. # Returns the index of the record or -1 if no record exists 24 25 # def findIndex ( records, firstname, lastname) : # Your code goes here: 26 27 #Sets the birthday of the record at the given index # Returns: nothing def setBirthday (records, index, newBirthday): # Your code goes here: 28 29 30 31 32 (1:0) 09% Type here to search
# Sets the birthday of the record at the given index # Returns: nothing def setBirthday (records, index, newBirthday): 29 30 31 32 # Your code goes here: 33 # Convert the 2d array back into # Return the text of the 2d array, def makeTextFrom2dArray (records): # Your code goes here: 34 string a 35 36 37 38 39 40 # Our main code body, where we call our functions. 41 # 42 # 43 # 44 # Load our records from the file into a 2d array 45 records load2dArrayFromFile (P) 46 47 # Find out which index, if any, has the name we are hunt indexWeAreHunting findIndex ( records , F, L) 48 49 50 # Set the birthday record to the one we were passed setBirthday(records, indexWeAreHunting, B) 51 52 53 # Convert the records into a text string 54 makeText From2 dArray (records) output 55 56 # Your code goes here 57 # write the text string out to the file 58 59 e% ( 1:0) Hi e Type here to search
ta formats llenge: variable length records Search for the firstname F and lastname L. replacing the birthday with B.Write the file back out in the same pipe- delimited format Check It! LAST RUN on 6/11/2019 9:41:23 PM X Program Output There is an error is your program. Sorry: IndentationError: expected an indented block (variable-length.py, line 26) Next 943 F 6/11/20
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Your function load2dArrayFrom file has no indented block to execute.

It is still empty.

So, try to implement the functions with the proper code and try compiling. It will execute fine.

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
#Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B=...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • B Codio - IT-140-R5545 Intro Mail - thon a https://codio.com/twinters/file-handling:5cb76949180630 Codio Project File Edit Find View...

    B Codio - IT-140-R5545 Intro Mail - thon a https://codio.com/twinters/file-handling:5cb76949180630 Codio Project File Edit Find View Tools Education Help ngth-.. # Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4] # Your Code Goes Here open (P, "r") f.readlines () f lines f.close() f- open (P, "a") for line in lines: line[:16].strip() and L = line[16:32].strip () : if F == print ("%16s%16s%16s "% ( F, L, B) ) else: print (line)...

  • The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13,...

    The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … The next number is found by adding up the two numbers before it. For example, the 2 is found by adding the two numbers before it (1+1). The 3 is found by adding the two numbers before it (1+2). The 5 is found by adding the two numbers before it (2+3), and so on! Each number in the sequence is called...

  • Use your Food class, utilities code, and sample data from Lab 1 to complete the following...

    Use your Food class, utilities code, and sample data from Lab 1 to complete the following Tasks. def average_calories(foods):     """     -------------------------------------------------------     Determines the average calories in a list of foods.     foods is unchanged.     Use: avg = average_calories(foods)     -------------------------------------------------------     Parameters:         foods - a list of Food objects (list of Food)     Returns:         avg - average calories in all Food objects of foods (int)     -------------------------------------------------------     """ your code here is the...

  • Use the csv file on spotify from any date Code from lab2 import java.io.File; import java.io.FileNotFoundException;...

    Use the csv file on spotify from any date Code from lab2 import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class SongsReport {    public static void main(String[] args) {               //loading name of file        File file = new File("songs.csv"); //reading data from this file        //scanner to read java file        Scanner reader;        //line to get current line from the file        String line="";       ...

  • Hw08FinalProjectStudentList.txt: (Data structure is Array List) 1,Simon,Jefferson,gy3085,4.0,2019 2,John,Johnson,xy1242,3.9,2019 3,Kayla,Anderson,as1324,3.8,2019 4,David,Kidman,re5423,3.8,2017 5,Mary,Coleman,ze7698,3.8,2018 Description: This assignment is

    Hw08FinalProjectStudentList.txt: (Data structure is Array List) 1,Simon,Jefferson,gy3085,4.0,2019 2,John,Johnson,xy1242,3.9,2019 3,Kayla,Anderson,as1324,3.8,2019 4,David,Kidman,re5423,3.8,2017 5,Mary,Coleman,ze7698,3.8,2018 Description: This assignment is going to evaluate your overall knowledge of the Java Programming. You shall implement a program which can store and retrieve student list. The program has a menu that you can take input from console, and the user can choose between the items. The program data is in the HwO8FinalProjectStudentList.txt file. Required Items: 1. The program must show a menu to user and ask the user...

  • Before you start For this homework, we will need to import some libraries. You need to...

    Before you start For this homework, we will need to import some libraries. You need to execute the following cell only once; you don't need to copy this in every cell you run. In [ ]: import pandas import numpy from urllib.request import urlretrieve from matplotlib import pyplot %matplotlib inline ​ #This library is needed for testing from IPython.display import set_matplotlib_close set_matplotlib_close(False) Introduction In this homework, you will work with data from the World Bank. The subject of study is...

  • Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What...

    Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What This Assignment Is About? Classes (methods and attributes) • Objects Arrays of Primitive Values Arrays of Objects Recursion for and if Statements Selection Sort    Use the following Guidelines: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc.) Use upper case for constants. • Use title case (first letter is upper case) for classes. Use lower case with uppercase...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

  • Rework this project to include a class. As explained in class, your project should have its...

    Rework this project to include a class. As explained in class, your project should have its functionalities moved to a class, and then create each course as an object to a class that inherits all the different functionalities of the class. You createclass function should be used as a constructor that takes in the name of the file containing the student list. (This way different objects are created with different class list files.) Here is the code I need you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT