From 101a7d3785322f31ea3fb27c9888504ac93680e9 Mon Sep 17 00:00:00 2001 From: ns9137625751 <72907070+ns9137625751@users.noreply.github.com> Date: Sat, 2 Oct 2021 13:19:11 +0530 Subject: [PATCH 1/2] Create Python Program to Count the Number of Each Vowel --- ... Program to Count the Number of Each Vowel | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Python Program to Count the Number of Each Vowel diff --git a/Python Program to Count the Number of Each Vowel b/Python Program to Count the Number of Each Vowel new file mode 100644 index 0000000..297e248 --- /dev/null +++ b/Python Program to Count the Number of Each Vowel @@ -0,0 +1,19 @@ +# Program to count the number of each vowels + +# string of vowels +vowels = 'aeiou' + +ip_str = 'Hello, have you tried our tutorial section yet?' + +# make it suitable for caseless comparisions +ip_str = ip_str.casefold() + +# make a dictionary with each vowel a key and value 0 +count = {}.fromkeys(vowels,0) + +# count the vowels +for char in ip_str: + if char in count: + count[char] += 1 + +print(count) From 4d4e69f5fae6fd2b572c8bcccd44c15716253fab Mon Sep 17 00:00:00 2001 From: ns9137625751 <72907070+ns9137625751@users.noreply.github.com> Date: Sat, 2 Oct 2021 13:21:20 +0530 Subject: [PATCH 2/2] Create Python Program to Merge Mails --- Python Program to Merge Mails | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Python Program to Merge Mails diff --git a/Python Program to Merge Mails b/Python Program to Merge Mails new file mode 100644 index 0000000..04c93cc --- /dev/null +++ b/Python Program to Merge Mails @@ -0,0 +1,20 @@ +# Python program to mail merger +# Names are in the file names.txt +# Body of the mail is in body.txt + +# open names.txt for reading +with open("names.txt", 'r', encoding='utf-8') as names_file: + + # open body.txt for reading + with open("body.txt", 'r', encoding='utf-8') as body_file: + + # read entire content of the body + body = body_file.read() + + # iterate over names + for name in names_file: + mail = "Hello " + name.strip() + "\n" + body + + # write the mails to individual files + with open(name.strip()+".txt", 'w', encoding='utf-8') as mail_file: + mail_file.write(mail)