Python Answers

Questions answered by Experts: 5 288

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

# Create displayList

displayList = []


# Loop through the prices in levelsList.

# During each loop:

# - Create a variable called priceLevelLabel consisting of the text 'Price Level: ' followed

# by the price.

# - Add priceLevelLabel and the price as two separate items to a new list (the sub-List).

# - Append the sub-List to displayList.

for price in self.levelsList:

...


# Loop through the prices in levelsList.
# During each loop:
# - Create a variable called priceLevelLabel consisting of the text 'Price Level:    ' followed
#   by the price.
# - Add priceLevelLabel and the price as two separate items to a new list (the sub-List).
# - Append the sub-List to displayList.
for price in self.levelsList:
    ...

# Create a variable called previousPriceLabel consisting of the text 'Previous Price: ' followed
# by previousPrice.
# Add previousPriceLabel and previousPrice as two separate items to a new list (the sub-List).
# Append the sub-List to displayList.
...

# Create a variable called currentPriceLabel consisting of the text 'Current Price:  ' followed
# by currentPrice.
# Add currentPriceLabel and currentPrice as two separate items to a new list (the sub-List).
# Append the sub-List to displayList.
...




Give a string writen a program to mirror the characters of the string in alphabetical order to create a secret message
Give a list of numbers write a program to print the smallest postive integer missing in the give numbers

Suppose there is XYZ Company and there are different departments like production, marketing, finance, sales etc. Manager of the company want to know about the detail of the employees who are highly paid in each of the department. Write a program using the concept of classes to implement the same.


Q2. A vender wants to determine whether he should serve foods to someone. He only serves
foods to people whose age is 18 or more and when he is not on fasting. Given the person's age,
and whether fasting time is in session, create a function which returns whether he should serve
foods.
Examples
should_serve_foods(17, True) ➞ False(No serve foods)
should_serve_foods(19, False) ➞ True(serve foods)
should_serve_foods(30, True) ➞ False(No serve foods)
Q1. Suppose there is two different types of dictionary, one dictionary contains registration
number and name of student and another dictionary contains registration number and marks.
Take 5 student details. Now display the student's result in terms of grade from the following
condition:
If marks between 90 to 100:grade'O'
marks between 80 to 90:grade'A+'
marks between 70 to 80:grade'A'
marks between 60 to 70:grade'B+'
marks between 50 to 60:grade'B'
Display result in the form of dictionary.
Suppose there is two different types of dictionary, one dictionary contains employee id and
name of employee and another dictionary contains employee id and salary. Take 5 employee
details. Now display the employee's designation from the following condition:
If salary between 80,000 to 90,000:designation:Project Manager
salary between 70,000 to 80,000:designation:Team Leader
salary between 60,000 to 70,000:designation:Software Developer
salary between 50,000 to 60,000:designation:Software Trainee
Display result in the form of dictionary.
Part 2

Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.

Include all of the following in your Learning Journal:

An explanation of each stage of development, including code and any test input and output.
The output of three calls to your function with different arguments.
Part 1
Section 6.2 of your textbook describes incremental development. Do the exercise at the end of that section:

As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)

After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.

Include all of the following in your Learning Journal:

An explanation of each stage of development, including code and any test input and output.
The output of hypotenuse(3,4).
The output of two additional calls to hypotenuse with different arguments.
LATEST TUTORIALS
APPROVED BY CLIENTS