This should fix it:
salaries['John'] = str(int(salaries['John']) + 30)
You need to convert the salaries of John to an int add 30 and then convert it back to a string.
This will change salaries['John']
from 20 to 50
More Related Contents:
- Is there a way to ordinate numbers in a list?
- Print elements of list horizontally [closed]
- Code to calculate file compression on python [closed]
- Get raw key value
- Download file from web in Python 3
- “:=” syntax and assignment expressions: what and why?
- Python, TypeError: unhashable type: ‘list’
- How to convert ‘binary string’ to normal string in Python3?
- Python, HTTPS GET with basic authentication
- Conditionally fill column values based on another columns value in pandas
- Python – TypeError: ‘int’ object is not iterable
- How can I get 2.x-like sorting behaviour in Python 3.x?
- How to redirect with post data (Django)
- Powersets in Python using itertools
- ImportError: No module named ‘django.core.urlresolvers’
- Recursively iterate through all subdirectories using pathlib
- How to make a custom object iterable?
- Basemap import error in PyCharm — KeyError: ‘PROJ_LIB’
- Identifier normalization: Why is the micro sign converted into the Greek letter mu?
- asterisk in tuple, list and set definitions, double asterisk in dict definition
- Python 3.7.0 No module named ‘PyQt5.QtWebEngineWidgets’
- How to use collections.abc from both Python 3.8+ and Python 2.7
- How to get the previous URL from a POST in Django
- How to encode Python 3 string using \u escape code?
- Nested Loop Python
- environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON
- Loading text file containing both float and string using numpy.loadtxt
- Why is Python’s eval() rejecting this multiline string, and how can I fix it?
- Skip elements on a condition based in a list comprehension in python
- TypeError: cannot unpack non-iterable NoneType object