Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Describe how tuples can be useful with loops over lists and dictionaries, and give Python code examples. Create your own code examples. Do not copy them from the textbook or any other source. 


Your descriptions and examples should include the following: the zip function, the enumerate function, and the items method.


Type the statements below into your Python interpreter. For each statement, copy the output into your Discussion Assignment and explain the output. Compare it with any similar examples in the textbook, and describe what it means about your version of Python. 

>>> print 'Hello, World!'

>>> 1/2

>>> type(1/2)

>>> print(01)

>>> 1/(2/3)


Finally, create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references.
in terms of arguments, parameters, objects, and references.

Create your own unique examples for this assignment.
pairs=[(x,y) for x in range(4) for y in range (3) if (x+y)%2!=0]
output for Print(type(10)
In your program, friends.py, we will practice working with sets. Download the file, people.txt, from Canvas. Read in the file and create a dictionary with the names as keys and the set of interests as values. Display the possible names to the user and then allow the user to choose two names to compare their interests. Make use of exception handling to ensure the 2 names (keys) they have chosen are in the dictionary you have created. If one of the names they enter is not in the dictionary, allow them to choose again until both names are valid. If the user enters 'done', end the program. Then give the user following options for comparing the two people: what they have in common, all interests they don't have in common, what interests are individual to each person, and also to back/choose new people. Create three functions, one for each type of comparison. Use set methods or the short cuts, to get the requested information. Print the result of the comparison chosen. I can give the .txt file upon request.
Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in this format:

#1: You entered _____
When STOP is entered, the total number of words entered should be printed in this format:

All done. __ words entered.
Sample Run
Please enter the next word: cat
#1: You entered cat
Please enter the next word: iguana
#2: You entered iguana
Please enter the next word: zebra
#3: You entered zebra
Please enter the next word: dolphin
#4: You entered dolphin
Please enter the next word: STOP
All done. 4 words entered.
A bank maintains a savings accounts for customers.
The saving account provides simple interest and withdrawal facilities but no cheque book facilities.
Rate(%) Time(yrs)
0.05 <5
0.15 5-10
0.25 >10
Create a binary file'account' that stores the customers, name, account number.
Include the member functions so as to achieve (Any 2)the following.:
i) Accept deposit from the customer and update account.
ii) Show the balance when requested.
iii) Compute interest on the saving account( where the user will enter time).
i) Permit withdrawal after checking the balance and then update
the account
Write a for loop to print the numbers 88, 84, 80, ...44 on one line.
LATEST TUTORIALS
APPROVED BY CLIENTS