diff --git a/024/input/letters/starting_letter.txt b/024/input/letters/starting_letter.txt new file mode 100644 index 0000000..078bf54 --- /dev/null +++ b/024/input/letters/starting_letter.txt @@ -0,0 +1,7 @@ +Dear [name], + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/input/names/invited_names.txt b/024/input/names/invited_names.txt new file mode 100644 index 0000000..4371e89 --- /dev/null +++ b/024/input/names/invited_names.txt @@ -0,0 +1,8 @@ +Aang +Zuko +Appa +Katara +Sokka +Momo +Uncle Iroh +Toph \ No newline at end of file diff --git a/024/main.py b/024/main.py new file mode 100644 index 0000000..ce64676 --- /dev/null +++ b/024/main.py @@ -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) diff --git a/024/output/ready_to_send/example.txt b/024/output/ready_to_send/example.txt new file mode 100644 index 0000000..e90e0d7 --- /dev/null +++ b/024/output/ready_to_send/example.txt @@ -0,0 +1,7 @@ +Dear Aang, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Aang.txt b/024/output/ready_to_send/to_Aang.txt new file mode 100644 index 0000000..e90e0d7 --- /dev/null +++ b/024/output/ready_to_send/to_Aang.txt @@ -0,0 +1,7 @@ +Dear Aang, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Appa.txt b/024/output/ready_to_send/to_Appa.txt new file mode 100644 index 0000000..5f5f9e8 --- /dev/null +++ b/024/output/ready_to_send/to_Appa.txt @@ -0,0 +1,7 @@ +Dear Appa, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Katara.txt b/024/output/ready_to_send/to_Katara.txt new file mode 100644 index 0000000..792f750 --- /dev/null +++ b/024/output/ready_to_send/to_Katara.txt @@ -0,0 +1,7 @@ +Dear Katara, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Momo.txt b/024/output/ready_to_send/to_Momo.txt new file mode 100644 index 0000000..ec71c68 --- /dev/null +++ b/024/output/ready_to_send/to_Momo.txt @@ -0,0 +1,7 @@ +Dear Momo, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Sokka.txt b/024/output/ready_to_send/to_Sokka.txt new file mode 100644 index 0000000..f893099 --- /dev/null +++ b/024/output/ready_to_send/to_Sokka.txt @@ -0,0 +1,7 @@ +Dear Sokka, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Toph.txt b/024/output/ready_to_send/to_Toph.txt new file mode 100644 index 0000000..d0fa800 --- /dev/null +++ b/024/output/ready_to_send/to_Toph.txt @@ -0,0 +1,7 @@ +Dear Toph, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Uncle Iroh.txt b/024/output/ready_to_send/to_Uncle Iroh.txt new file mode 100644 index 0000000..2a016e0 --- /dev/null +++ b/024/output/ready_to_send/to_Uncle Iroh.txt @@ -0,0 +1,7 @@ +Dear Uncle Iroh, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela diff --git a/024/output/ready_to_send/to_Zuko.txt b/024/output/ready_to_send/to_Zuko.txt new file mode 100644 index 0000000..dbf6750 --- /dev/null +++ b/024/output/ready_to_send/to_Zuko.txt @@ -0,0 +1,7 @@ +Dear Zuko, + +You are invited to my birthday this Saturday. + +Hope you can make it! + +Angela