Reference no: EM132360783
Create Python programs to do the following (the names of the programs that you should save them as precede the program specification):
1. Invite.py: Create a list of five names, such as ['Margot', 'Kathryn', ‘Pamela']. Create a for loop that iterates through the list and creates a string with the words "Hi', the name of the friend and the words ". Please come to my party on Saturday!" so that the result looks like:
Hi Margot. Please come to my party on Saturday!
Hi Kathryn. Please come to my party on Saturday!
Hi Pamela. Please come to my party on Saturday!
2. Difference.py: Create two lists: list1 = [2, 6, 10] and list2 = [1, 3, 5]. Create a for loop that iterates through the two lists and calculates the difference between the respective element of each list. Also in the for loop, find the difference squared and keep a running total of that number.
Print the difference after each time it is calculated and the sum after each time it is calculated, so that it looks like this:
The difference is xxx
The sum is yyy
where xxx and yyy are the calculated values.
3. Odd.py: Write a program that generates all odd numbers from 1 to n. Ask the user for n and set n in the beginning of the program. Use a while loop to compute the numbers and create a list that contains the numbers. The print out the resulting list.