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 program to find modules , exponentiation , power.


a company is planning a big sale at which they will give their customers a special promotional discount. each customer that purchases a product from the company has a unique customer id numbered from 0 to n-1.

1.andy, the marketing head of the company, has selected bill amounts of the n customers for the promotional scheme. the discount will be given to the customers whose bill amounts are perfect squares. the customers may use this discount on a future purchase. write an algorithm to help andy find the number of customers that will be given discounts?


an ecommerce website wishes to find the lucky customer who will be eligible for full value cashback. for this purpose, a number n is fed to the system. it will return another number that is calculated by an algorithm. in an algorithm, a sequence is generated, in which each number is the sum of the two preceding numbers. initially, the sequence will have two 1's in it. the system will return the nth number from the generated sequence which is treated as the order id. the lucky customer will be the one who has placed that order. write an algorithm to help the website find the lucky customer.


an ecommerce company plans to give their customers a discount for the new year. the discount will be calculated on the basis of the bill amount is the product of the sum of all odd digits and the sum of even digits of the customer's total bill. if no odd-even digit is represented in the bill amount then 0 will be returned?


1.usernum=int(input())

2.user Numspuared= userNum +User Num

3.

4.print(userNumspuared, end=‘ ‘)


python implement data structures?


startmsg = "python"
endmsg = ""
for i in range(1,1+len(startmsg)):
  endmsg = startmsg[-i] + endmsg




There is a singly linked list represented by the following structure:
struct Node int data;
struct Node* next;
Implement the following function:
struct Node
DeleteNodes (struct Node* head);
The function accepts a pointer to the start of the linked list, 'head' argument. Delete all such nodes from the input list whose adjacent on the right side has greater value and return the modified linked list. Note: . Return null if the list is empty (Incase of python if the list is No return None). Do not create a new linked list, just modify the input linked list an . return it. Example: Input: head: 6->2->5->4->9->7->2>1>5->9 Output: 65-9->7->2->9 Explanation: Node '2' is deleted as '2' < '5' then '4' is deleted as '4' < '9' then '1' deleted as '1' < '5' then '5' is deleted as '5' < '9'. Sample Input head: 9- 5 - 6 - 2 -> 7 Sample Output​
1. Edit, Debug and Run the given Python script files: TP1.py
2. The Evaluator will allocate marks based on the correct output results

"""In distributed systems, it is a good idea to segregate threads into groups
if they are performing different tasks. Say, for instance, you have an
application that both listens for incoming stock price changes
and also tries to predict where that price will go. You could, for instance,
have two different thread groups here: one group listening for the changes
and the other performing the necessary calculations.
"""
import threading
import time
def myThread():
print("Thread {%} starting".format(threading.currentThread().getName()))
time.sleep(10)
print("Thread {} ending".format(threading.currentThread().getName()))
for i in range(4):
threadName = "Thread-" + str(i)
thread = threading.Thread(name=threadName, target=myThread)
thread.start()
print("{#}".format(threading.enumerate()))
Edit, Debug and Run the given Python script files
"""In distributed systems, it is a good idea to segregate threads into groups
if they are performing different tasks. Say, for instance, you have an 
application that both listens for incoming stock price changes 
and also tries to predict where that price will go. You could, for instance, 
have two different thread groups here: one group listening for the changes 
and the other performing the necessary calculations.
"""
import threading
import time
def myThread():
    print("Thread {%} starting".format(threading.currentThread().getName()))
    time.sleep(10)
    print("Thread {} ending".format(threading.currentThread().getName()))
for i in range(4):
    threadName = "Thread-" + str(i)
    thread = threading.Thread(name=threadName, target=myThread)
    thread.start()
  • print("{#}".format(threading.enumerate()))




LATEST TUTORIALS
APPROVED BY CLIENTS