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

  1. To find the lucky number.

Input - 8, Output - 21

Write an algorithm to make a list like 1,1,2,3,5,8,13,21 so when input 8 is entered it should give output 21.(NA)




Suppose the university has decided to announce bonus 1 PMS point to employees those have PMS points more than 7. The appraisal will be based on PMS points. We have an array of employees with UID and PMS point . Display the list of employees those would be benefited with bonus. The bonus should be added to the employees who have UID and PMS through the concept of list comprehension.

Input Format The input should contain list of employees with UID and PMS point.

Output Format For each test case, display the UID and PMS point after bonus is being added


SOLVE IT USING PYTHON

The manager of the company has informed his assistant to enter the


age of all the workers working in production department. Among all


he has to find the employee with minimum age employee. Help the


manager to find the minimum age employee by storing the all age of


all employees in 1D array. Use functions to solve this task.


Input Format


30 43 27 51 19


Constraints


All the inputs should be greater than 0 otherwise print wrong input


Output Format


19



SOLVE IT USING PYTHON


your given two integers. a and b print the smallest among a%b and b%a


Write a python program to calculate the fare and discount for the passengers travelling in a bus. When a Passenger enters the bus, the program, will determine the traveling kilometer knowing distance from passenger (as an approximate integer) the conductor mentions the fare to the passenger according to following criteria below using control structure in python code.The program will also calculate the passenger 20% discount for students ,PWD and senior citizen passenger.

5KM- 25.00

5-10KM – 30.00

10-30KM – 50.00

30-50KM -100.00

50-80KM – 150.00

80-100KM – 250.00



The Error of this code is expected an intended block

kindly check and show the correct code


class AddColumn:


def add_column(str1,list1):


dict1[str1].append(list1)


x=AddColumn()






x.add_column( "City name",["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])


x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])


x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])


x.add_column("Annual Rainfall"[600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])






print(dict1)


The error of this code is Expected an indented block.

kindly check and show the correct code


main_list = []

x = {}

field_names = [ "City name", "Area", "Population", "Annual Rainfall"]



list1 = [



 ["Adelaide", 1295, 1158259, 600.5],

 

 ["Brisbane", 5905, 1857594, 1146.4],

 

 [ "Darwin", 112, 120900, 1714.7],

 

 ["Hobart", 135, 20556, 619.5],

 

 ["Sydney", 2058, 4336374, 1214.8],

 

 ["Melbourne", 1566, 3806092, 646.9],

 

 ["Perth", 5386, 1554769, 869.4]

 ]



for i in range(0, len(list1)):



 for key in field_names:



 for value in list1[i]:



 x[key] = value



 list1[i].remove(value)

 break

main_list.append(x)

print(main_list)


The problem with this code is No module named 'prettytable'

can you show the correct code?



table = PrettyTable()


table.field_names = ["pokemon name", "type"]

table.add_row(["pikachu", "Electric"])

table.add_row(["sydney", "Dark"])

table.add_row(["charmander", "Fire"])

table.add_row(["squite", "Water"])

print(table)





Program that will accept number of students and number of quizzes of students. Program will accept the name of the student and the quiz grades of the student. The input will be stored to a dictionary. The name of the student will be the key and the quizzes will be the value in list format (e.g., {“Jose S. Uy”: [87,90,97,80,95], “Rowena M. Evangelista”: [88,87,90,97,83].


The program will output the list of quizzes per student, the lowest quiz, the highest quiz, and the average quiz grade.

 

EXAMPLE:

number of students: 2

number of quizzes: 5

 

student 1: Jose S. Uy

quiz 1: 87

quiz 2: 90

quiz 3: 97

quiz 4: 80

quiz 5: 95


student 2: Rowena M. Evangelista

quiz 1: 88

quiz 2: 87

quiz 3: 90

quiz 4: 97

quiz 5: 83

 

 

Quiz Result:

 

Student 1: Jose S. Uy

Quizzes: [87, 90, 97, 80, 95]

Lowest: 80

Highest: 97

Average: 89.8


Student 2: Rowena M. Evangelista

Quizzes: [88, 87, 90, 97, 83]

Lowest: 83

Highest: 97

Average: 89

 



Write a program to write info from a txt. file. You are to create a file that writes the text from your file and puts "*" on either side of your text. The number of stars on each side is to equal the line number from the text you read. ie. line 10 has 10 stars on either side - **********Introducing*********. Your file is to end when the program reads EXIT.


LATEST TUTORIALS
APPROVED BY CLIENTS