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

write a python function which take list A as input and return five lists, one contains all prime numbers in A, second one contains composite numbers in A, the third list contains all numbers in A which are neither divisible by 2, fourth and fifth list contains number divisible by 3 and 5 respectively.



write a program to print of sum of two number a and b if there sum is less than two otherwise print the product of number


Create a Python script that will compute the NET Salary of an employee from an input number of hours worked and the rate per hour. An additional 20% of the overtime pay if an employee worked for more than 40 hours of regular work.


Sample Output:

Hours Worked : 45

Rate (per Hour): 200

Basic Pay : 8000

Overtime Pay : 1000

Incentive : 200

NET Salary is 9200


I need the code to have an output as stated above.


Convert the Number

Given a number having ten digits, convert it to a string following the below-mentioned rules.


Rules for conversion:

1.separate the number into a set of four-three-three digits

2.Use the following prefixes for successive digits

a.Single numbers: just read them separately

b.Two consecutive numbers: double

c.Three consecutive numbers: triple

d.Four consecutive numbers: quadruple


Input

The first line of input is a string of ten digits.



Sample Input1

9887666668

Sample Output1

nine double eight seven triple six double six eight


Sample Input2

9090407368

Sample Output2

nine zero nine zero four zero seven three six eight


  1. *5.39 (Financial application: find the sales amount) You have just started a sales job in a department store. Your pay consists of a base salary plus a commission. The base salary is $5,000. The following scheme shows how to determine the commission rate:

   

https://revel-ise.pearson.com/courses/6123e8c3e405345b4db8cc88/pages/a01d5f11c73c1edccab32f3f774833239daa8769e Page 11 of 15

Programming Exercises from the Book: Chapter 5 8/23/21, 3:12 PM

Note that this is a graduated rate. The rate for the first $5,000 is at 8%, the next $5,000 is at 10%, and the rest is at 12%. If the sales amount is 25,000, the commission is 5,000 * 8% + 5,000 * 10% + 15,000 * 12% = 2,700. Your goal is to earn $30,000 a year. Write a program that finds the minimum sales you have to generate in order to make $30,000.


First Run Server.py on the HOST side and run Client.py on the User side

After running Client.py on the User side I need four functions that the user side runs: REGISTER user, Display Registered users, De-register User

To Register a user to the Host server (aka Connect to the host server) you must have the input: “REGISTER <username (any name)>, <IP address of that user that wants to register> <PORT #s (range limit is 49152 through 65535)>”

After running the REGISTER COMMAND, it will either output “REGISTERED” or “NOT REGISTERED” on the user client-side If “REGISTERED” output is displayed, the User client should now be connected to the Host Server and Host Server can either save registered(connected) users in a list/database and/or output on Host Server-side “Connection at <username of user client> <IP ADDRESS of user client> <port # of user client (range limit is 49152 through 65535 >”


New Dictionary

Peter is making a new dictionary.He wants to arrange the words in the ascending order of their length and later arrange the ones with the same length in lexicographic order.Each word is given a serial number according to its position.Find the word according to the serial number.

Input

The first line of input is a positive integer which is the serial number.


Word Serial Number

A 1

B 2

C 3

... ...

X 24

Y 25

Z 26

AA 27

AB 28

... ...

BA 53

... ...

ZZ 702

AAA 703

Explanation

Given serial number is 42.

As the serial number is between 26 and 52, the first character of the word is A.The remaining counter of the serial number is 16 (42-26).

The second character of the word is the 16th alphabet, which is P.

So, the output should be AP.


Sample Input1

42

Sample Output1

AP


Sample input2

751

Sample output2

ABW



New Dictionary


Peter is making a new dictionary.He wants to arrange the words in the ascending order of their length and later arrange the ones with the same length in lexicographic order.Each word is given a serial number according to its position.Find the word according to the serial number.


Input

The first line of input is a positive integer which is the serial number.


Output

The output should be a single line containing the word that represents the serial number.


Explanation

Given serial number is 42.

As the serial number is between 26 and 52, the first character of the word is A.The remaining counter of the serial number is 16 (42-26).

The second character of the word is the 16th alphabet, which is P.

So, the output should be AP.


Sample Input1

42

Sample Output1

AP


Sample input2

751

Sample output2

ABW


Convert the Number

Given a number having ten digits, convert it to a string following the below-mentioned rules.


Rules for conversion:

1.separate the number into a set of four-three-three digits

2.Use the following prefixes for successive digits

a.Single numbers: just read them separately

b.Two consecutive numbers: double

c.Three consecutive numbers: triple

d.Four consecutive numbers: quadruple


Input

The first line of input is a string of ten digits.



Sample Input1

9887666668

Sample Output1

nine double eight seven triplesix double six eight


Sample Input2

9090407368

Sample Output2

nine zero nine zero four zero seven three six eight


Find area and perimeter of square


Algorithm:


get the value of side

multiply side by side to calculate area

multiply side by 4 to calculate perimeter

print area

print perimeter


'''


side = eval(input("Enter the value of the side "))


area = side * side

perimeter = 4 * side


print ("The side of the square is",side)

print ("The area is",area)

print ("The perimeter is",perimeter)




LATEST TUTORIALS
APPROVED BY CLIENTS