Question

Please write comments with the program. Python programming!! Part III - write student data In this...

Please write comments with the program.

Python programming!!

  • Part III - write student data

In this part the program should create a .csv file and fill it with generated student information.

The program should:

  • Ask the user for a name for the .csv file (use your own name for the exercise)
  • Create the .csv file with columns named - ID, first-name, GPA
  • Based on the information received in part I, generate and fill students information in the CSV file
  • Tell the users how many lines are filled with values in the .csv file and ask how many to present
  • Output the values based on the user input

Remember:

  • Only use the material covered in this module -- do not use more advanced functions not covered yet in the course
  • Make sure to include comments that explain all your steps (starts with #). Also use a comment to sign your name at the beginning of the program!
  • Work individually and only submit original work
  • Run the program a few times to make sure it executes and meets all the requirements
  • Submit a .py file!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output(console)

student.csv(after running the program)

CODE:

 #get the name of the file from the user filename=input("Enter the name of the csv file: ") #add .csv to filename filename+=".csv" #open the file in write mode file=open(filename,"w") #write the heading to csv file file.write("ID,first-name,GPA\n") #get number of entries from the user n=int(input("Enter number of student entries: ")) #for i from 0 to n-1 for i in range(n): #prompt the user to enter id,name and gpa print("Enter ID,FistName,GPA of Student ",i+1) id=input() name=input() gpa=input() #write id,name,gpa to file #all separated by commas(in csv files,columns are separated by commas) file.write(id+","+name+","+gpa+"\n") #close the file file.close()
Add a comment
Know the answer?
Add Answer to:
Please write comments with the program. Python programming!! Part III - write student data In this...
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
  • Must be done in python and using linux mint Write a program to create a text...

    Must be done in python and using linux mint Write a program to create a text file which contains a sequence of test scores. Each score will be between 0 and 100 inclusive. There will be one value per line, with no additional text in the file. Stop adding information to the file when the user enters -1 The program will first ask for a file name and then the scores. Use a sentinel of -1 to indicate the user...

  • Exercise 6: Program exercise for 2D List Write a complete Python program including minimal comments (file...

    Exercise 6: Program exercise for 2D List Write a complete Python program including minimal comments (file name, your name, and problem description) that solves the following problem with the main function: Problem Specification: The following code reads values from the file object infile and stores them in the 2d list table2: (It assumes that each line contains values of elements in each row and the values are whitespace separated.) table2 = [] for line in infile: row=line.split() intRow = []...

  • For each problem, you must: Write a Python program Test, debug, and execute the Python program...

    For each problem, you must: Write a Python program Test, debug, and execute the Python program Save your program in a .py file and submit your commented code to your Student Page. Note regarding comments: For every class, method or function you create, you must provide a brief description of the what the code does as well as the specific details of the interface (input and output) of the function or method. (25 pts.) Write a program that reads in...

  • Python programming! Can you redo this program with comment and with clear ident. Part II -...

    Python programming! Can you redo this program with comment and with clear ident. Part II - Read student names Ask the user for a file containing possible first names (for this exercise use firstnames.txt attached to the assignment or download it from here: https://drive.google.com/file/d/1U-eOg8znWEoOcIPOWTT8due-svjNdnPc/view?usp=sharing). Read the file for all the names. Remember the names are not case sensitive and some may appear a few times. Calculate and output: How many unique names are in the file? Number only Which names...

  • PLEASE INCLUDE COMMENTS In java Create a Java Program Add the following comments at the beginning...

    PLEASE INCLUDE COMMENTS In java Create a Java Program Add the following comments at the beginning of the file: Your name. The name of the class(es) used in the program. The core concept (found below) for this lesson. The date the program was written. Include a recursive method separate from the main method that will add together all of the even numbers between and including 1 and the value the user supplies. For instance, if the user enters 10 then...

  • assignment 1 Make sure you are able to write a python program as described in the...

    assignment 1 Make sure you are able to write a python program as described in the text. You will be working in repl.it Title your program temperature. Add a comment to say that this program converts Fahrenheit to Centigrade. Create variables: fahrenheit and centigrade values my name Have the program prompt the user (the instructor) for a value for the fahrenheit variable. Convert the value to centigrade, using this formula: (fahrenheit - 32) * ÷ 9 = centigrade Have the...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Please use Python for this program Random Number File Writer Write a program that writes a...

    Please use Python for this program Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range 1 through 500. The program should let the user specify how many random numbers to put into the file. The name of the file to write to should be 'random.txt'. Submit the random.txt file generated by your program with the assignment. Sample program execution: Python 3.4.3 Shell Eile Edit...

  • Could anyone please help with this Python code assignment? In this programming assignment you are to...

    Could anyone please help with this Python code assignment? In this programming assignment you are to create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The count of how many numbers are in the file. The average of the numbers. The average is the sum of the numbers divided by how many there are. The maximum value. The...

  • Create a Python Program that will ask the user for a password (use input) Verify that...

    Create a Python Program that will ask the user for a password (use input) Verify that the password meets the following conditions: -must be 12 characters long -must have uppercase and lowercase -must contain at least 1 special character (!~#$%^&*{}+_) -must be a mix of numbers and letters You must do this only using regular expressions so for instance this will not be accepted if len(password) <12: At the end of the program tell the user their password is ok...

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