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
Jane wants to add a chart to her presentation so she’ll click the Insert tab and in the Images group, she’ll click the Chart but
kap26 [50]

(A. Stevie only) because You need to go the illustrations tab in order to click on the chart button.

Jane clicked on images tab so she was wrong.

Mark as brainlest plz :)

3 0
3 years ago
The amount of magnification gained from the extension tube is dependent on the focal length of the lens.
jenyasd209 [6]
The statement, "The amount of magnification gained from the extension tube is dependent on the focal length of the lens" is true.
6 0
3 years ago
Read 2 more answers
What can we learn from the example of the wi-fi alliance with regard to the necessity of networking standards?
Vera_Pavlovna [14]
The Wi-Fi alliance is an alliance that promotes the wireless technologies and the interoperability between them. It defines the the security of the wireless technologies and the application protocols. From this example we can learn that is crucial to have one platform that defines the main characteristic of a type of network in order to have strictly defined standards and protocols, and by doing so, have interoperable networks. 
7 0
3 years ago
What is scratch programming​
Vitek1552 [10]

Answer:

Scratch is a programming language and an online community where children can program and share interactive media such as stories, games, and animation with people from all over the world.

Explanation:

3 0
3 years ago
Read 2 more answers
Which of the following class definitions is correct in Java?(i)public class Student{private String name;private double gpa;priva
Soloha48 [4]

Answer:

The answer is "Option 3".

Explanation:

In the given question the code (ii) is correct because in the class definition class "Student" defines a constructor that does not use any return type. and code (i) class definition the class "Student" defines a constructor that uses return type void which is not allowed in the constructor. and other options are not correct that can be described as follows:

  • In option 1, only code (ii) is correct.
  • In option 2, code (ii) is correct that's why it is not correct.
  • In option 4, it is not correct, because it uses void return type.

4 0
3 years ago
Other questions:
  • The ___ of a worksheet defines its appearance
    13·1 answer
  • The _______________ layer of the TCP/IP protocol suite is responsible for making sure that what leaves one end of the network ar
    9·1 answer
  • Tfuuvj vjiibjoon Ghosh kpj
    13·2 answers
  • There is a simple pattern for derermining if a binary number is odd. What is it and why does this pattern occur?
    8·1 answer
  • When you pass an argument to a method, the argument's data type must be ____________ with the receiving parameter's data type?
    11·1 answer
  • Which one of these choices best describes what exec() does:a) It replaces the current process with a new oneb) It executes a new
    6·1 answer
  • Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate l
    14·1 answer
  • What is the theory of relativity? How does it relate to the creation of electricity through solar energy?
    12·1 answer
  • HELP FAST PLEASE
    5·2 answers
  • According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel and we run it on a machine with 4 pr
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!