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
Write a C program to implement a command called ​displaycontent ​that takes a (text) file name as argument and display its conte
Zanzabum

Answer:

/*

Student: Hugo Meza

Date: February 15, 2019

Description: This program mimic the cat command from Linux. Checks whether the source file

has the right permissions, and then writes in the console its content.

*/

#include <stdio.h>

#include <fcntl.h>

#include <unistd.h>

#include <errno.h>

int hasPermission(char *filepath){

int returnval;

// Check file existence

returnval = access (filepath, F_OK);

if(errno == ENOENT){

printf ("%s does not exist\n", filepath);

return 0;

}

else if (errno == EACCES){

printf ("%s is not accessible\n", filepath);

return 0;

}

// Check read access

returnval = access (filepath, R_OK);

if(errno == ENOENT){

printf ("%s does not have read access\n", filepath);

return 0;

}

else if (errno == EACCES){

printf ("%s is not accessible\n",filepath);

return 0;

}

// Check write access

returnval = access (filepath, W_OK);

if(errno == ENOENT){

printf ("%s does not have read access\n", filepath);

return 0;

}

else if (errno == EACCES){

printf ("%s is not accessible\n",filepath);

return 0;

}

return 1;

}

int main(int argc, char* argv[]){

if(!argv[1]){

printf("Error. Specify file to open\n");

return 0;

}

int fd;

char *fp = argv[1], content[fd];

if(hasPermission(fp) == 0)

return 1;

fd = open(fp, O_RDONLY);

int bytes = read(fd,content,sizeof(content)-1);

write(1, content, bytes);

close(fd);

return 0;

}

Explanation:

7 0
3 years ago
Which of the following is not a benefit of introducing an e-commerce solution to an organisation?
emmainna [20.7K]

Answer:

A. Improving human resource management by offering more information to employees about available services, from annual leave arrangements to retirement plans.

Explanation:

e-commerce is a short for electronic commerce and it can be defined as a marketing strategy that deals with meeting the needs of consumers, by selling products or services to the consumers over the internet.

This ultimately implies that, e-commerce is strictly based on the buying and selling of goods or services electronically, over the internet or through a digital platform. Also, the payment for such goods or services are typically done over the internet such as online payment services.

Some of the benefit of introducing an e-commerce solution to an organisation's includes;

I. Improving internal communication by offering various means for exchanging information with minimum effort and cost.

II. Reducing the personalisation of services.

III. Supporting purchasing functions by offering responsive pricing models based on the analysis of market status.

7 0
2 years ago
6.8 Code Practice<br> please can have some help please
babymother [125]
Sure what is the question though
7 0
2 years ago
Which website can help you find antivirus software ?
sergey [27]

If you have windows you have Windows Defender Installed already!!

5 0
3 years ago
On the first line, place your name in a comment. Create a program that does the following: Take in three integer numbers from th
Helen [10]

Answer and Explanation:

//buchi

Var firstNumber=prompt("please enter first number");

Var secondNumber=prompt("please enter second number");

Var thirdNumber=prompt("please enter third number");

Var numberTotal=firstNumber+secondNumber+thirdNumber;

Function calculateNumbers(){

return numberTotal;

return int(numberTotal/3);

return firstNumber*secondNumber*thirdNumber;}

Console.log(calculateNumbers());

8 0
3 years ago
Other questions:
  • if the president goes for vice president after his 2 term and the present president dies is the old president the president agai
    8·2 answers
  • Explique si en la pc que se usa para hacer las tareas escolares se puede ver un video juego de los llamados “pesados”
    13·1 answer
  • • What is the difference between primary storage, secondary storage, and off-line storage
    10·1 answer
  • Which command is not one of the available Change Case options?
    11·1 answer
  • Describe the components of a CPU--the CU, ALU, and Cache--and explain how they interact to make the CPU function.
    13·1 answer
  • What year did the first hovercraft sail on water
    15·1 answer
  • Write a program that reads a string and outputs the number of times each lowercase vowel appears in it. Your program must contai
    14·1 answer
  • What keys on the keyboard have the ability to move the cursor around on a window?
    11·1 answer
  • I found a brand-new charger wire still in its plastic package, but it's six years old and has never been used. Is it safe to use
    9·1 answer
  • By default word documents include _______ margins on all sides of the document.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!