Creating a player character.
Role playing games require players to adopt a virtual character in the game. Characters often have traits recorded as numerical values for strength, dexterity, constitution, intelligence, wisdom and charisma. This program creates a simple character and saves it to a file.
Write a program that asks the user to enter the name of a character, together with their health, attack and defend as numbers. The program should write the data to a file.
Use this boilerplate code as a starting point:
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
Enter the name of the character: Elf
Enter health: 10
Enter attack: 13
Enter defend: 8
Character saved.
Use these resources as a reference to help you meet the success criteria.
Run the unit tests below to check that your program has met the success criteria.
[Name]
Elf
[Attributes]
health=23
attack=45
defend=67
Check that you have: