Jan-28-2018, 10:46 PM
Hi everyone,
I am using the enumerate function on a string returned by the user and I am trying to transform this to a dictionary. If I try to use the dict() command python just ignores the request.
Here is the code I have:
I am using the enumerate function on a string returned by the user and I am trying to transform this to a dictionary. If I try to use the dict() command python just ignores the request.
Here is the code I have:
import string what = input ("Please tell me the string you want to use: ") letter = input ("What is the letter you want me to find: ") values = {} numbs = () a = what.find (letter) if a == -1: print ("not there") else: e = enumerate(what) #The below is code to test what is happening print (type(e)) print (e) for x in e: print (x)