1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zepelin [54]
3 years ago
15

Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the

event information found in the event details file. Put all the generated invitation files in a directory called invitations. Ensure that the name of each invitation file uniquely identifies each guest's invitation
Computers and Technology
1 answer:
vlada-n [284]3 years ago
7 0

Answer:

Code:  

import os   # os module to create directory  

event_file = open("event_details.txt", "r") # Getting event file  

event_details = ""  # event details to be stored  

for row in event_file:  # traversing through the event_file  

   event_details += row    # appending event details  

os.mkdir("./invitations")   # make directory in the same parent directory  

names = open("guest_list.txt", "r") # getting names of the people  

for name in names:  # traversing through names in guest_list file

   name = name.replace('\n', '')   # removing the ending '\n' from the name  

   invitation_msg = "Hi! " + name + ", You are heartly invited in the Ceremony.\nAt " + event_details # Generating the invitation message  

   file_name = '_'.join(name.split(' '))   # Spliting name in space and joining with the '_'  

   file_path = "./invitations/" + file_name + ".txt" # Generating each file path  

   invite_file = open(file_path, "w")  # Creating the file for each name  

   invite_file.write(invitation_msg)   # Write invitation to file

Output:

You might be interested in
Inserting diagrams into documents can help readers better understand document text. True or False?
Masja [62]
It's true because you can get a better understanding when looking at the evidence.
4 0
3 years ago
I need someone who knows HTML to finish the code.
Maksim231197 [3]
I recommend you go to Stacks Overflow . There are many experienced coders there that would gladly answer your question.
7 0
3 years ago
Read 2 more answers
How does an agile team obtain clarity on backing items that may be picked up in upcoming iterations? (1 correct answer)
Vinvika [58]

Answer:

The correct answer to the following question will be "Option 4".

Explanation:

Group seems to have a backlog optimization conversation with either the company owner after each iteration to obtain insight about the backlog things to have been collected in the future iterations or executions.

  • Without the need to get feedback on the backlog or pending things in preparation for potential implementations.
  • The next phase brings the dedicated backlog to completion. Iteration targets are calculated, based on dedicated research.
8 0
4 years ago
Which from the following list are an example of productivity software?
Scorpion4ik [409]
D. All of the Above.....
3 0
4 years ago
Read 2 more answers
Which data type is 2.5?<br> single<br> int<br> float<br> string
Ivenika [448]

2.5 is an example of a float.

Floats are numbers that have decimals.

5 0
3 years ago
Other questions:
  • Being aware of and understanding why potential buyers on a web site do not complete their purchases requires the expertise of __
    11·2 answers
  • The conscious process of planning and controlling how you spend your time is called?
    15·1 answer
  • How do you take apart a I pad and put it back together and it still works
    5·1 answer
  • Technology will not? A. change the way work is done B. process information faster C. slow the pace of work D. link companies and
    8·1 answer
  • Select the three early tools that were prototypes of modern farming tools used for harvesting crops.
    14·1 answer
  • The Mohs scale is used to express which mineral property?
    15·1 answer
  • The function of network switch is to _____.
    5·1 answer
  • Developing algorithms using psuedocode
    15·1 answer
  • Can someone suggest how to manage a group when you are the group leader?​
    10·2 answers
  • The temperature at 8 AM was 44°F and at noon it was 64°F. what was the percent of change from 8 AM to noon?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!