Answer to Question #280540 in Python for Rahul Sigh

Question #280540

Bob decided to go on a trip. There are total N kids on the trip. There are 3 types of toys - 'Type-I ', 'Type-2', and 'Type-3' available for distribution among N kids. Each of the kids is asked, what kind of toy he prefers from the current lot. If the kid does not like any toy from the current lot, then he or she would get a toy among the remaining types with equal probability.


For Full Instructions and Question Please Use Those Images as reference... Please help


https://drive.google.com/file/d/1b3RT2IBIBMG2Ojob6uGqoDglXHg-Z928/view?usp=sharing





1
Expert's answer
2021-12-20T10:01:41-0500
dict1 = [1,-1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,1,-1]
dict2 = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
def string_process(string):
    ind1 = dict2.index(string[len(string)-1])
    if dict1[ind1-1] == 1:
        string.replace(dict2[ind1-1],dict2[ind1])
    else:
        string.replace(dict2[ind1-1],dict2[ind1-2])

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS