day 24 - a joke
This commit is contained in:
7
024/input/letters/starting_letter.txt
Normal file
7
024/input/letters/starting_letter.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear [name],
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
8
024/input/names/invited_names.txt
Normal file
8
024/input/names/invited_names.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Aang
|
||||||
|
Zuko
|
||||||
|
Appa
|
||||||
|
Katara
|
||||||
|
Sokka
|
||||||
|
Momo
|
||||||
|
Uncle Iroh
|
||||||
|
Toph
|
||||||
20
024/main.py
Normal file
20
024/main.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#TODO: Create a letter using starting_letter.txt
|
||||||
|
#for each name in invited_names.txt
|
||||||
|
#Replace the [name] placeholder with the actual name.
|
||||||
|
#Save the letters in the folder "ReadyToSend".
|
||||||
|
|
||||||
|
#Hint1: This method will help you: https://www.w3schools.com/python/ref_file_readlines.asp
|
||||||
|
#Hint2: This method will also help you: https://www.w3schools.com/python/ref_string_replace.asp
|
||||||
|
#Hint3: THis method will help you: https://www.w3schools.com/python/ref_string_strip.asp
|
||||||
|
|
||||||
|
|
||||||
|
with open("input/names/invited_names.txt") as n:
|
||||||
|
for name in n.readlines():
|
||||||
|
name = name.strip()
|
||||||
|
output_letter = ""
|
||||||
|
with open("input/letters/starting_letter.txt") as l:
|
||||||
|
for letter_line in l:
|
||||||
|
output_letter += letter_line.replace("[name]", name)
|
||||||
|
|
||||||
|
with open(f"output/ready_to_send/to_{name}.txt", "w") as final:
|
||||||
|
final.write(output_letter)
|
||||||
7
024/output/ready_to_send/example.txt
Normal file
7
024/output/ready_to_send/example.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Aang,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Aang.txt
Normal file
7
024/output/ready_to_send/to_Aang.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Aang,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Appa.txt
Normal file
7
024/output/ready_to_send/to_Appa.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Appa,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Katara.txt
Normal file
7
024/output/ready_to_send/to_Katara.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Katara,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Momo.txt
Normal file
7
024/output/ready_to_send/to_Momo.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Momo,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Sokka.txt
Normal file
7
024/output/ready_to_send/to_Sokka.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Sokka,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Toph.txt
Normal file
7
024/output/ready_to_send/to_Toph.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Toph,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Uncle Iroh.txt
Normal file
7
024/output/ready_to_send/to_Uncle Iroh.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Uncle Iroh,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
7
024/output/ready_to_send/to_Zuko.txt
Normal file
7
024/output/ready_to_send/to_Zuko.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Dear Zuko,
|
||||||
|
|
||||||
|
You are invited to my birthday this Saturday.
|
||||||
|
|
||||||
|
Hope you can make it!
|
||||||
|
|
||||||
|
Angela
|
||||||
Reference in New Issue
Block a user