Tell us what’s happening:
My code doesn’t work, the console shows
Traceback (most recent call last):
File “main.py”, line 63, in
File “main.py”, line 21, in create_character
TypeError: ‘<’ not supported between instances of ‘tuple’ and ‘int’
Please send help, thank you in advance!
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(c_name, c_str, c_int, c_cha):
if not isinstance(c_name, str):
return 'The character name should be a string'
if c_name == '':
return 'The character should have a name'
if len(c_name) > 10:
return 'The character name is too long'
if c_name.count(' ') > 1:
return 'The character name should not contain spaces'
if not ((c_str, c_int, c_cha),(int, float)):
return 'All stats should be integers'
if (c_str, c_int, c_cha) < 1:
return 'All stats should be no less than 1'
if (c_str, c_int, c_cha) > 4:
return 'All stats should be more than 4'
t_stats = c_str + c_int + c_cha
if t_stats != 7:
return 'The character should start with 7 points'
if (c_str, c_int, c_cha) == 1:
return '●○○○○○○○○○'
if (c_str, c_int, c_cha) == 2:
return '●●○○○○○○○○'
if (c_str, c_int, c_cha) == 3:
return '●●●○○○○○○○'
if (c_str, c_int, c_cha) == 4:
return '●●●●○○○○○○'
if (c_str, c_int, c_cha) == 5:
return '●●●●●○○○○○'
if (c_str, c_int, c_cha) == 6:
return '●●●●●●○○○○'
if (c_str, c_int, c_cha) == 7:
return '●●●●●●●○○○'
if (c_str, c_int, c_cha) == 8:
return '●●●●●●●●○○'
if (c_str, c_int, c_cha) == 9:
return '●●●●●●●●●○'
if (c_str, c_int, c_cha) == 10:
return '●●●●●●●●●●'
create_character('fan', 3, 3, 2)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character