with open("bankaccount.txt", 'a+') as f:
if User1_working_status =="1":
f.write("{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n".format("Name: " + user1_title + " " + user1_name,
"Gender:" + user1_gender,"Town and country: "
+ user1_town, "Age: " + user1_age,"Country and town of birth: "+ user1_country_of_birth,"Nationality: "
+ user1_nationality,"Country residence:"+user1_country_residence,"Tax resident country: "
+ user1_tax_res,"Working status: Employed"))
print("Working status: Employed")
elif User1_working_status=="2":
f.write("{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n".format("Name: " + user1_title + " " + user1_name, "Gender:"
+ user1_gender,"Town and country: " + user1_town, "Age: " + user1_age,"Country and town of birth: "
+ user1_country_of_birth,"Nationality: "+ user1_nationality,
"Country residence:"+user1_country_residence,"Tax resident country: "+ user1_tax_res,
"Working status: Self Employed"))
print("Working status: Self Employed")
Is there a way to shorten this? I have the same for user 2 but then I have to do everything again with user2_working_status and the code gets too long since I have 9 options..So if there's a way to combine both user1 and user2 in this code?:)