full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
if not isinstance(name, str):
return "The character name should be a string"
if name == '':
return 'The character should have a name'
if len(name) > 10:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
if type(strength) is not int or type(intelligence) is not int or type(charisma) is not int:
return 'All stats should be integers'
if strength < 1 or intelligence < 1 or charisma < 1:
return 'All stats should be no less than 1'
if strength > 4 or intelligence > 4 or charisma > 4:
return 'All stats should be no more than 4'
if strength + intelligence + charisma != 7:
return "The character should start with 7 points"
create_character('ren', 4,2,1)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
When you call the function with this data, the function parameters take those values, so name is “ren”, strength is 4, intelligence is 2, and charisma is 1.
Use those parameters to build the requested string: ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
Start simply by building this piece: ren\nSTR , then use the global variables provided to make the correct number of filled dots based on the value of strength. Then add the remaining empty dots. Etc.
you need to create a string that has that format, 4 lines with the first line for the name and the other three with the three letter abbreviation of the stat and the dots to rapresent how many points on the stat
It looks like you are just hard coding the expected string. You should use the function parameters to determine the values used in the string. The way it is, your function will always return the same thing no matter what values are passed to it.
I mean, what if I call your function like this: create_character('godzilla',3,2,2)?