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 short note on Computer<br>impact on<br> our society?​
Vesna [10]

well not a note but here are some few points

Explanation:

1 Computers can have the huge impact on employment of people like job and other stuff.

2 lots of human can be jobless or unemployed

3 it can cuz impact on the health of peoples

4 it also can make us lazy and and lack of self knowledge

8 0
2 years ago
Read 2 more answers
How are special characters added to a Word document? Check all that apply.
Musya8 [376]

Answer:

by using keystroke codes

by using the character map

by using the Symbols command group

by using the Symbol drop-down arrow

6 0
3 years ago
Read 2 more answers
Do you get notified if someone follows you on Spotify like your email or do you just have to find out on your own
pav-90 [236]
Answer: Spotify does not have a feature to notify you of new followers.
8 0
2 years ago
Write a recursive method named binarySearch that accepts a sorted array of integers and an integer target value and uses a recur
djyliett [7]

Answer:

10

-1

Process finished with exit code 0

Explanation: see code bellow

public class BinarySearchRecursive {

   public static int binarySearch(int[] a, int key) {

       return binarySearchRecursiveHelper(a, key, 0, a.length - 1);

   }

   public static int binarySearchRecursiveHelper(int[] arr, int target, int start, int end) {

       if (start > end) {

           return -1;

       }

       int mid = (start + end) / 2;

       if (arr[mid] == target) {

           return mid;

       } else if (target < arr[mid]) {

           return binarySearchRecursiveHelper(arr, target, start, mid - 1);

       } else {

           return binarySearchRecursiveHelper(arr, target, mid + 1, end);

       }

   }

   public static void main(String[] args) {

       int[] a = {-4, 2, 7, 10, 15, 20, 22, 25, 30, 36, 42, 50, 56, 68, 85, 92, 103};

       int index = binarySearch(a, 42);   // 10

       System.out.println(index);

       index = binarySearch(a, 66);   // -1

       System.out.println(index);

   }

}

6 0
2 years ago
What is the downside of wider channel bandwidth?
Lana71 [14]

Answer: Wider channel bandwidth has several downside or disadvantages to it. Some of these are as follow:

a) Higher channel bandwidth means lower will be the number of channels being utilized.

b) Wider bandwidth may lead to an increase in the speed but on the other hand, it'll lead to several interference problems.

6 0
3 years ago
Other questions:
  • This provides an easy method for workers to use their computers.
    11·2 answers
  • What is the name of the process of heat transfer in which heat is transmitted through light waves?
    7·2 answers
  • It is okay to use a dust rag when cleaning the inside of a computer.
    9·2 answers
  • An email address is made up of all of the following parts except
    13·2 answers
  • How to make flashcards on microsoft word 2010?
    7·1 answer
  • Universal Container sales reps can modify fields on an opportunity until it is closed. Only the sales operations team can modify
    13·1 answer
  • 16. Which of the following wire gage sizes is the thickest? A. 14 B. 8 C. 0 D. -33
    14·1 answer
  • What electronic device can represent a KiloByte?
    14·1 answer
  • The command to get out of the loop.<br>a.<br>i exit<br>ii. break<br>iii. comment<br>iv. for​
    12·1 answer
  • (a) What is the meaning of word 'computer (b) Cive a reason for the evolution of computer (c) Write a weakness of a computer (d)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!