Python list problem quotes

hi, I got numbers in the style of 1,2,3 as input here, but it will be entered as “1,2,3”. How can i get rid of quotation marks?

values=input("enter:")

list1=values.split(",")



print(list1)

listt=[]
sumlist=[]

for i in list1:
    
   
    i=int(i)
    
    if i>0:
        sumlist.append(i)
    
    
    if i%2==0 and i>0:
        listt.append(i)
        

        
print("Even numbers: {}".format(listt))   

sum1=sum(listt)
print("Sum of even numbers: {}".format(sum1))
allsum=sum(sumlist)
print("Even number rate: {}".format(sum1/allsum))

ı did it and it solved

for i in liste:
    if i=="," or i=='"':
        continue

now it’s causing a negative number of problems

how can ı fix that problem

Please provide the input and output you are generating AND what output you expected.
This way it’s easier to understand what the problem is and give advice on how to fix it.
Also if you are getting an error, post the error message.

Right now I see you use a “sum1” in your output, but you never declare it anywhere in your code.
I think it’s supposed to be sum1 = sum(listt) ?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.