yandex
loader

please wait

  • Rahul Chaudhary Mar-13-2019 06:32:27 AM ( 1 week ago )

    #Modify the code below so that the function sense, which #takes p and Z as inputs, will output the NON-normalized #probability distribution, q, after multiplying the entries #in p by pHit or pMiss according to the color in the #corresponding cell in world.

    p=[0.2, 0.2, 0.2, 0.2, 0.2]
    world=['green', 'red', 'red', 'green', 'green']
    Z = 'red'
    pHit = 0.6
    pMiss = 0.2
    
        def sense(p, Z):
        q=[]
        for i in range(p):
            if(Z==word[i]):
                q.append(p[i]*pMiss)
            else:
                q.append(p[i]*pHit)
        return q
    
    print sense(p,Z)
  • NeelKamal Jha Mar-13-2019 06:34:06 AM ( 1 week ago )
     

    I think your function signature is not properly indented, look at following code :

    p=[0.2, 0.2, 0.2, 0.2, 0.2]
    world=['green', 'red', 'red', 'green', 'green']
    Z = 'red'
    pHit = 0.6
    pMiss = 0.2
    
    def sense(p, Z):
        q=[]
        for i in range(p):
            if(Z==word[i]):
                q.append(p[i]*pMiss)
            else:
                q.append(p[i]*pHit)
        return q
    
    print sense(p,Z)
  • Jai Khanna Mar-13-2019 06:35:25 AM ( 1 week ago )

     

     

    def sense(p, Z): should not be indented.

Please login

Similar Discussion

Recommended For You