I started this class as a complete beginner, i finished the first lesson on python where we learned some basic functions and variables etc while making a caesar cypher that didnt actually end up being anything that works.
now i started on this create an rpg character, trying to use the things we learned in the previous lesson, ive looked at the forum but i cant see anyone thats typing it up based on what we learned, it looks like everyone else is using advanced things off google so that didnt really help meβ¦
I got to challenge 8 but for some reason it failed, I cant see why it failed i even cross checked my function on google AI
(i know its kind of a mess and its done in a round about way a little bit but like i said im trying to do it with the information they taught us in the previous lessons.β
i also think i wont get much further even if i pass challenge 8 because im not sure how to implement the graphic thing i just started messing with that once i got frustrated lolβ¦
full_dot = 'β'
empty_dot = 'β'
#display generator
gr_a = "\nSTR "
gr_i = "\nINT "
gr_c = "\nCHA "
name = "ren"
stren = 4
intel = 2
char = 1
def stat_points (stren, intel, char):
return
def ui_stats (name,gr_a, stren_graphic,gr_i, intel_graphic,gr_c, char_graphic):
return
#graphic
def stren_graphic(stren):
full_dot = 'β'
empty_dot = 'β'
max_stren = 7
full_dots = full_dot * stren
empty_dots = empty_dot * (max_stren - stren)
return full_dots + empty_dots
def intel_graphic(intel):
full_dot = 'β'
empty_dot = 'β'
max_intel = 7
full_dots = full_dot * intel
empty_dots = empty_dot * (max_intel - intel)
return full_dots + empty_dots
def char_graphic(char):
full_dot = 'β'
empty_dot = 'β'
max_char = 7
full_dots = full_dot * char
empty_dots = empty_dot * (max_char - char)
return full_dots + empty_dots
def create_character(name, stren, intel, char):
if not isinstance(name, str):
return "The character name should be a string"
if not len(name) < 10:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
if not isinstance(stren, int) or not isinstance(intel, int) or not isinstance(char, int):
return "All stats should be integers"
if (stren) < 1 or (intel) < 1 or (char) < 1:
return "All stats should be no less than 1"
if (stren) > 1 or (intel) > 1 or (char) > 4:
return "All stats should be no more than 4"
if stren + intel + char != 7:
return "The character should start with 7 points"
else:
print(ui_stats)
SORRY I CANT DELETE OR EDIT MY ORIGINAL POST. I HAVE SINCE UPDATED IT.
I started this class as a complete beginner, i finished the first lesson on python where we learned some basic functions and variables etc while making a caesar cypher that didnt actually end up being anything that works.
now i started on this create an rpg character, trying to use the things we learned in the previous lesson, ive looked at the forum but i cant see anyone thats typing it up based on what we learned, it looks like everyone else is using advanced or different things off google so that didnt really help me⦠is that what were supposed to be doing?
I got to challenge 9 but for some reason its throwing some error about ui_stats, I cant see why it failed and I am too new to figure it out.
(i know its kind of a mess and its done in a round about way a little bit but like i said im trying to do it with the information they taught us in the previous lessons.β
not sure if this is possible to even do the way I set it up, is the stren_graphic etc, function, not ouputing the dots into the ui_stats function or is there some kind of spacing issue the way I did the stupid gr_a gr_i etc lolβ¦
thanks.
full_dot = 'β'
empty_dot = 'β'
gr_a = "\nSTR "
gr_i = "\nINT "
gr_c = "\nCHA "
max_stat = 7
def ui_stats (name,gr_a,stren_graphic,gr_i, intel_graphic,gr_c,char_graphic):
def stren_graphic(stren):
sfull_dots = full_dot * stren
sempty_dots = empty_dot * (max_stat - stren)
return sfull_dots + sempty_dots
def intel_graphic(intel):
ifull_dots = full_dot * intel
iempty_dots = empty_dot * (max_stat - intel)
return ifull_dots + iempty_dots
def char_graphic(char):
cfull_dots = full_dot * char
cempty_dots = empty_dot * (max_stat - char)
return cfull_dots + cempty_dots
#graphic
def create_character(name, stren, intel, char):
if not isinstance(name, str):
return "The character name should be a string"
if not len(name) < 10:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
if not isinstance(stren, int) or not isinstance(intel, int) or not isinstance(char, int):
return "All stats should be integers"
if (stren) < 1 or (intel) < 1 or (char) < 1:
return "All stats should be no less than 1"
if (stren) > 4 or (intel) > 4 or (char) > 4:
return "All stats should be no more than 4"
if stren + intel + char != 7:
return "The character should start with 7 points"
return ui_stats
I understand what youre saying, sorry it was only my second day reading and trying to write this stuff. I think i was a little confused about the purpose of return, I just sort of did what the tutorial found acceptable and let me proceed with.
Ill try to adjust it to work properly based on this advice.
okay, so based on your advice, I have spent around 3 hours playing with this and I definitely understand it a lot more now, but ive hit another obstacle in that the output seems perfectly fine but for some reason its still failing challenge 9;
9. create_character("ren", 4, 2, 1) should return ren\nSTR ββββββββββ\nINT ββββββββββ\nCHA ββββββββββ.
full_dot = 'β'
empty_dot = 'β'
max_stat = 10
stren_dots = "0"
intel_dots = "0"
char_dots = "0"
name = ""
stren = 0
intel = 0
char = 0
def create_character(name, stren, intel, char):
if not isinstance(name, str):
return "The character name should be a string"
if not len(name) < 10:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
if not isinstance(stren, int) or not isinstance(intel, int) or not isinstance(char, int):
return "All stats should be integers"
if (stren) < 1 or (intel) < 1 or (char) < 1:
return "All stats should be no less than 1"
if (stren) > 4 or (intel) > 4 or (char) > 4:
return "All stats should be no more than 4"
if stren + intel + char != 7:
return "The character should start with 7 points"
def stren_graphic():
sfull_dots = full_dot * stren
sempty_dots = empty_dot * (max_stat - stren)
global stren_dots
stren_dots = sfull_dots + sempty_dots
stren_graphic()
def intel_graphic():
ifull_dots = full_dot * intel
iempty_dots = empty_dot * (max_stat - intel)
global intel_dots
intel_dots = ifull_dots + iempty_dots
intel_graphic()
def char_graphic():
cfull_dots = full_dot * char
cempty_dots = empty_dot * (max_stat - char)
global char_dots
char_dots = cfull_dots + cempty_dots
char_graphic()
print(name + "\nSTR", stren_dots + "\nINT", intel_dots + "\nCHA", char_dots)
create_character("ren", 4, 2, 1)
it outputs exactly as requested and the output is altered respective of the inputs. I wonder if its the challenge looking for a specific code that i didnt use because i did it an alternative noob way lol
my output is;
ren
STR ββββββββββ
INT ββββββββββ
CHA ββββββββββ
is that the little square box at the bottom of the output, for some reason I can see the ren, str bar etc then at the bottom theres a square box⦠so its working but also outputing none lol hmm
hi sorry, I got locked out because im only allowed 6 replies in my first 24 hrs.
lol just wanted to say thank you so much for your help. I really do understand what return and print and call means now!
also was stuck on 10 for a few minutes, what a silly issue that was, i had name length set to less than 10 instead of 10 or less, smhβ¦
thanks again!
in case anyone else was curious heres my final result, I know its not as elegant as it could be but that wasnt my goal ;
full_dot = 'β'
empty_dot = 'β'
max_stat = 10
stren_dots = "0"
intel_dots = "0"
char_dots = "0"
name = ""
stren = 0
intel = 0
char = 0
ui = ""
def create_character(name, stren, intel, char):
if not isinstance(name, str):
return "The character name should be a string"
if not len(name) < 11:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
if not isinstance(stren, int) or not isinstance(intel, int) or not isinstance(char, int):
return "All stats should be integers"
if (stren) < 1 or (intel) < 1 or (char) < 1:
return "All stats should be no less than 1"
if (stren) > 4 or (intel) > 4 or (char) > 4:
return "All stats should be no more than 4"
if stren + intel + char != 7:
return "The character should start with 7 points"
else:
def stren_graphic():
sfull_dots = full_dot * stren
sempty_dots = empty_dot * (max_stat - stren)
global stren_dots
stren_dots = sfull_dots + sempty_dots
stren_graphic()
def intel_graphic():
ifull_dots = full_dot * intel
iempty_dots = empty_dot * (max_stat - intel)
global intel_dots
intel_dots = ifull_dots + iempty_dots
intel_graphic()
def char_graphic():
cfull_dots = full_dot * char
cempty_dots = empty_dot * (max_stat - char)
global char_dots
char_dots = cfull_dots + cempty_dots
char_graphic()
global ui
ui = name + "\nSTR " + stren_dots + "\nINT " + intel_dots + "\nCHA " + char_dots
return ui
create_character("aaabbbcccd", 4, 2, 1)
print (ui)