+ 1
Dictionary creating for Basic Sal and GrossSal
I wrote a programme for Gross Salary Calculation, Now I should create a dictionary which takes basic sal and gross sal as inputs. if I call the Basic Sal I should get the Gross Sal as output. Please help me.. https://code.sololearn.com/coX6fGnO0iY0/?ref=app
1 Antwort
+ 5
First of all, do not name your variable 'list', as it is a data type name and it might cause confusion later in the code. Let's assume it is a variable GrossSal for a minute.
Now, a zip() method does what you need:
d = dict(zip(BasicSal, GrossSal))
d will now have BasicSal's elements as keys and GrossSal's elements as values.
I hope that's what you meant :)