I have the following problem. Im trying to replace the name based on the input of gender. If anyone could help improve my code it would be really appreciated.
The text file(duedate.txt):
User: Tommy
Gender: Male
Date due: 2020-02-18
The code I have so far is:
with open f = ('duedate.txt).read()
z = input("Please select gender to change)
zz = input("Please select new name")
if z == 'female'
line.startswith('User'):
field, value = line.split(:)
value = zz
print (zz)
I know the code isn't 100% right but the output, if Jessica was chosen as the name, should be:
User: Jessica
Gender: Female
Date due: 2020-02-18