Question

write with python : –Write a program that will right-align text into 3 columns of data....

write with python :

–Write a program that will right-align text into 3 columns of data.

–When the program starts it will prompt the user for the maximum width of each column

0 0
Add a comment Improve this question Transcribed image text
Answer #1

width = eval(input("The maximum width of a column: "))
data = [
   {
       "name": "Raven",
       "pan": "16910310",
       "dob": "07-19-19"
   },
   {
       "name": "Kevyn",
       "pan": "16231106",
       "dob": "07-13-20"
   },
   {
       "name": "Jorden",
       "pan": "16870824",
       "dob": "01-24-19"
   },
   {
       "name": "Ella",
       "pan": "16231217",
       "dob": "03-21-19"
   },
   {
       "name": "Cameron",
       "pan": "16550421",
       "dob": "02-16-20"
   },
   {
       "name": "Declan",
       "pan": "16820607",
       "dob": "11-01-19"
   },
   {
       "name": "Mara",
       "pan": "16371021",
       "dob": "03-09-20"
   },
   {
       "name": "Aidan",
       "pan": "16380217",
       "dob": "06-30-19"
   },
   {
       "name": "Cheyenne",
       "pan": "16550616",
       "dob": "11-20-20"
   },
   {
       "name": "Aidan",
       "pan": "16450723",
       "dob": "10-06-20"
   },
   {
       "name": "Darrel",
       "pan": "16590213",
       "dob": "12-18-19"
   },
   {
       "name": "Vance",
       "pan": "16210408",
       "dob": "04-19-20"
   },
   {
       "name": "Wynter",
       "pan": "16800513",
       "dob": "09-10-19"
   },
   {
       "name": "Karly",
       "pan": "16850624",
       "dob": "06-07-20"
   },
   {
       "name": "Melinda",
       "pan": "16100826",
       "dob": "01-22-20"
   },
   {
       "name": "Kadeem",
       "pan": "16371028",
       "dob": "08-06-20"
   }
]
print("Name".center(width)+"PAN".center(width)+"DOB".center(width))
print("================================")
for obj in data:
print(f'{obj["name"].rjust(width)}{obj["pan"].rjust(width)}{obj["dob"].rjust(width)}')

Add a comment
Know the answer?
Add Answer to:
write with python : –Write a program that will right-align text into 3 columns of data....
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
  • Part 3: Arrows Write a python program that prompts the user for a number of columns,...

    Part 3: Arrows Write a python program that prompts the user for a number of columns, and them prints the pattern as seen below. You cannot assume that the user will supply positive numbers - if they misbehave you should re-prompt them until they do give you a positive number. Note that your program only has to run one time, but multiple runnings of the program are shown below: How many columns? 3 * * * * * How many...

  • Write a PYTHON program that reads a file (prompt user for the input file name) containing...

    Write a PYTHON program that reads a file (prompt user for the input file name) containing two columns of floating-point numbers (Use split). Print the average of each column. Use the following data forthe input file: 1   0.5 2   0.5 3   0.5 4   0.5 The output should be:    The averages are 2.50 and 0.5. a)   Your code with comments b)   A screenshot of the execution Version 3.7.2

  • write a python program that ciphers a plain text message using double transposition scheme and vise...

    write a python program that ciphers a plain text message using double transposition scheme and vise versa. The program should accept five tuples of input: plain text, row, column, permutation of row and columns. Pain Text: attack at dawn Matrix Row Size: 5 Matrix Column Size: 3 Row Permutation Order: 3,5,1,4,2 Column permutation order: 1,3,2 Encrypted Text:

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a funct...

    Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...

  • Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in...

    Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in a file. Your program should prompt the user for the name of the file to use and then request values be entered until the user is done. This data should be written to two files: a text file, user_file_name.txt and a comma separated value file, user_file_name.csv. To help you with decision making, we suggest that you ask the user to input data representing students’...

  • Write a Python (3) program to simulate** a buffer overflow (this is a new script, not...

    Write a Python (3) program to simulate** a buffer overflow (this is a new script, not part of the intranet assignment), then implement input validation to prevent it. There are two parts to this assignment: 1) The program should display a welcome message and prompt the user for a username. Create a simulated buffer overflow condition by allowing a user to input more data than the size of the allocated memory (causing the program to crash). 2) Implement input validation...

  • Write a PYTHON program that allows the user to navigate the lines of text in a...

    Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...

  • Write a text analyzer program using Python. The program should prompt the user for text to...

    Write a text analyzer program using Python. The program should prompt the user for text to analyze using the following prompt: Please enter text to analyze or press ENTER (without text) to exit: If the following text is input into by the user: Fog everywhere. Fog up the river, where it flows among green aits and meadows; fog down the river, where it rolls deified among the tiers of shipping and the waterside pollutions of a great (and dirty) city....

  • 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...

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