Lesson 19 of 34
Dictionaries: ಹೆಸರಿನಿಂದ Values
10 min 30 XP
Dictionary ನಿಜವಾದ ನಿಘಂಟಿನಂತೆ ಕೆಲಸ ಮಾಡುತ್ತದೆ: ಪ್ರತಿ key ಗೆ ಒಂದು value. { } ಒಳಗೆ key: value ಜೋಡಿಗಳನ್ನು ಬರೆಯಿರಿ. Values ಅನ್ನು index ನಿಂದಲ್ಲ, key ಮೂಲಕ ಹುಡುಕುತ್ತೇವೆ.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.ಇಲ್ಲದ key ಕೇಳಿದರೆ error ಬರುತ್ತದೆ. get() ಬದಲಿಗೆ None ಅಥವಾ ನೀವು ಆರಿಸಿದ default ಕೊಡುತ್ತದೆ.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.Keys ಮತ್ತು values ಒಟ್ಟಿಗೆ loop ಮಾಡಲು items() ಬಳಸಿ.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.ಎಣಿಕೆಗೆ dictionaries ಸೂಕ್ತ: count[ch] = count.get(ch, 0) + 1. ಇದು interviews ನಲ್ಲಿ ಯಾವಾಗಲೂ ಬರುತ್ತದೆ!