Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Python Program to Count the Number of Each Vowel
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions Python Program to Merge Mails
Original file line number Diff line number Diff line change
@@ -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)