Help me in solving issues in my code plz

My issue

n=int(input())
for i in range(n):
sum1=0
m=input()
k=input()
x=[int(i) for i in m.split()]
j=[i for i in k]
p=[‘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’]
for am in p:
if(am not in j):
cn=p.index(am)
sum1+=cn+x[0]
print(sum1)
what is wrong in my code

My code

# cook your dish here
n=int(input())
for i in range(n):
    sum1=0
    m=input()
    k=input()
    x=[int(i) for i in m.split()]
    j=[i for i in k]
    p=['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']
    for am in p:
        if(am not in j):
            cn=p.index(am)
            sum1+=cn+x[0]
    print(sum1)
            
            

Problem Link: Mathison and pangrams Practice Coding Problem - CodeChef

@manoghyna
here ,plzz refer my c++ code for better understanding of the logic

#include<bits/stdc++.h> 
#include <iostream>
using namespace std;

int main() {
    int t; cin>>t ;
    
    while(t--){
        int array[26] ;
        for(int i = 0 ; i<26 ; i++){
            cin>>array[i] ;
        }
        
        string str ; cin>>str ;
        
        int freq[26]= {0} ;
        
        for(int i = 0; i<str.length() ; i++){
            int temp;
            temp = int(str[i]) - 97 ;
            
            freq[temp] ++ ;
        }
        
        int sum = 0 ;
        
        for(int i = 0 ; i< 26 ; i++){
            if(freq[i] == 0){
                sum= sum + array[i] ;
            }
        }
        
        
        cout<<sum<<endl ;
    }
	return 0;
}

Thank u so much @dpcoder_007