Note. This is in python 3. if you using python 2. I would suggest you jump over to python 3.
1. Python is strongly type but it all underneath the hood.
2. You use the best loop for the job. You should never delete an item in a for loop.
but in a while loop you can make adjustments.
example
1. Python is strongly type but it all underneath the hood.
2. You use the best loop for the job. You should never delete an item in a for loop.
but in a while loop you can make adjustments.
example
# Python is strongly type. You just don't see it def myfunction(): pass a = {} b = [] c = (1,1) print(type(1)) print(type('word')) print(type(0.5)) print(type(a)) print(type(b)) print(type(c)) print(type(c[0])) # first element print(type(myfunction)) print() a = {'one': 2, 3:4, 5:'six'} for key in a: # just loop over keys print(key) print() for key, value in a.items(): # iter over (key, value) print(key, value) print() for key in a.keys(): # iter of keys print(key) print() for value in a.values(): # iter over values print(value) a = dict([(key, value * 2) for key, value in a.items()]) print(a)
99 percent of computer problems exists between chair and keyboard.