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

Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following:

  • How to format each dictionary item as a text string in the input file.
  • How to covert each input string into a dictionary item.
  • How to format each item of your inverted dictionary as a text string in the output file.

Create an input file with your original three-or-more items and add at least three new items, for a total of at least six items.


Include the following in your Learning Journal submission: 

  • The input file for your original dictionary (with at least six items).
  • The Python program to read from a file, invert the dictionary, and write to a different file.
  • The output file for your inverted dictionary.
  • A description of how you chose to encode the original dictionary and the inverted dictionary in text files.

Wrie a program that generates a random number and asks the user to guess what the number

is. If the user's guess is higher than the random number, the program should display "Too high,

try again." If the user's guess is lower than the random number, the program should display

"Too

low, try again.

"The program should use a loop that repeats until the user correctly guesses the

random number. Program should count and display number of tries to win the game. (Use for

loop to solve the problem)


Create a text file with name "article.txt". Write a function in Python to count the number of articles

(words "a", "an", "the") present in a text file "article.txt"



Write a program that keeps student's name and his marks in a dictionary as key-value pairs. The

program should store records of 10 students and display students name and marks of five

students in decreasing order of marks obtained.


Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following:

  • How to format each dictionary item as a text string in the input file.
  • How to covert each input string into a dictionary item.
  • How to format each item of your inverted dictionary as a text string in the output file.

Create an input file with your original three-or-more items and add at least three new items, for a total of at least six items.


Include the following in your Learning Journal submission: 

  • The input file for your original dictionary (with at least six items).
  • The Python program to read from a file, invert the dictionary, and write to a different file.
  • The output file for your inverted dictionary.
  • A description of how you chose to encode the original dictionary and the inverted dictionary in text files.

Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post. 

Describe how you might deal with each error if you were writing a large production program. These descriptions should be general ideas in English, not actual Python code. 


Describe how catching exception can help with file errors. Write three python examples that actually generate file errors in your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post.


Write a Python class to convert an integer to a roman numeral.


Given an unsorted integer array, find out the pair whose sum is the given no.

        Example : {3,12,4,7,10,8}, No => 22, So pair is {12,10} 

Malayan Yellow Hut’s Pizza parlor has specialized systems that can identify how many slices that can be taken from a pizza of a given size. This system uses the following facts:


·      Each slice should have an area of 14.125 inches.

·      To calculate the number of slices, simply divide the area of the pizza by 14.125

·      The area of the pizza is calculated using the formula area = πr2.

 

Improve their systems by allowing it to identify how many pizzas should be ordered given a number of people expected to eat and the diameter of the pizza. Assume that each person is expected to eat an average of 4 slices.


Input:


1. nOp


Description

no of person

2. dia


Description

diameter of pizza

Output:

Enter·the·number·of·person:·30

Enter·the·diameter·of·the·pizza:·12

You·should·order·15·pizzas·for·30·persons.