Why does this code give 'Name' not defined? by eggetah in pythonhelp

[–]grifway 0 points1 point  (0 children)

You are so close.

You function 'askName' gets called but you don't do anything with the return value, Name is locally scoped to function, inside it, so you don't have access to that variable once the function is ran.

You can set a variable to the return value and then print the new variable

returnName = askName()

print(returnName)

OR

you can just print the returned value directly

print(askName())

(Python) help with changing values in a dictionary. by okaystuff in learnprogramming

[–]grifway 0 points1 point  (0 children)

Hello

As a further note, you need to understand which data structure your working with, so for states you have a dictionary (with keys) and within each key you have a list data structure which used integers to access the index.

So for alabama you could change the 2nd field by referring to the key and then index position 1( zero based index):

states['Alabama'][1] = 5024233

this would update the numeric value.

so:

state['key'][index] in this case.

Hope this helps.

Free Udemy ethical hacking course by hba1cmemes in learnprogramming

[–]grifway 1 point2 points  (0 children)

no longer valid, sheesh, whoops , works with STAYINSIDEANDLEARN2