u/Big_Example_3390

For the "I need Help" or "I'm N_e _w" posts and the Experienced Programmers.

im learning python in FCC right now. I jumped right into trying to program to start with and kept trying to start up by reading in the docs or following along with a tutorial on numpy or scipy... FCC is taking me through the logical thinking skills i need and making me solve problems and get together the fundamentals of coding.... ive been off and on trying to learn how to code for like 2 years now, given ive been through a lot with life struggles, but i kept searching and searching for a way to learn this stuff and never did anyhting about DSA or Problem-solving or logical thinking come up. I wonder why? All of the "I feel stupid and Am I just not meant to Code" posts i see in forums never mention or question if you know the fundamentals or even know where to get them from or that you need them. I wonder why Is that?

I hope this is a valid question that some more experienced people can answer and i hope it puts the right words and questions in other new learners minds

reddit.com
u/Big_Example_3390 — 4 days ago

FreeCodeCamp RPG Python Lab: It all looks right to me, but says its wrong.

#im honestly hella confused, it gives everything its supposed to and pulls up the right respose. I think it wants something specific that im  not aware of. 

full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
    stats = {strength, intelligence, charisma}
    if not isinstance(name, str):  #pulls up correctly 
        return print('The character name should be a string')
    
    elif name == '':   #pulls up correctly 
        return print('The character should have a name')
    
    elif len(name) > 10:  #pulls up correctly 
        return print('The character name is too long')
    
    elif ' ' in name:  #pulls up correctly 
        return print('The character name should not contain spaces') 
    
    else:  
        for x in stats:
            if not isinstance(x, int):  #if i put in ! or c without the "" around it it pulls an error 
                return print('All stats should be integers') 
        
            elif x < 1: #pulls correctly
                return print('All stats should be no less than 1')  
        
            elif strength > 4 or intelligence > 4 or charisma > 4: #pulls correctly
                return print('All stats should be no more than 4')  
        
            elif strength + intelligence + charisma != 7: #pulls correctly
                return print('The character should start with 7 points')   
            else:#pulls correctly......i dont get it 
                return print(f'{name}\nSTR {strength * full_dot + empty_dot * (10 - strength)}\nINT {intelligence * full_dot + empty_dot*(10 - intelligence)}\nCHA {charisma * full_dot + empty_dot * (10 - charisma)}')
                



create_character('ren',1,5,1)  

tests 2, 4, 6, 8, 10, 12, 14, 16, 18, 19 all fail

    1. You should have a function named create_character.
  • Failed:2. When create_character is called with a first argument that is not a string it should return The character name should be a string.
  • Passed:3. When create_character is called with a first argument that is a string it should not return The character name should be a string.
  • Failed:4. When create_character is called with a first argument that is an empty string, it should return The character should have a name.
  • Passed:5. When create_character is called with a first argument that is not an empty string, it should not return The character should have a name.
  • Failed:6. When create_character is called with a first argument that is longer than 10 characters it should return The character name is too long.
  • Passed:7. The create_character function should not say that the character is too long when it's not longer than 10 characters.
  • Failed:8. When create_character is called with a first argument that contains a space it should return The character name should not contain spaces.
  • Passed:9. When create_character is called with a first argument that does not contain a space it should not return The character name should not contain spaces.
  • Failed:10. When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers.
  • Passed:11. When create_character is called with a second, third and fourth argument that are all integers it should not return All stats should be integers.
  • Failed:12. When create_character is called with a second, third or fourth argument that is lower than 1 it should return All stats should be no less than 1.
  • Passed:13. When create_character is called with a second, third and fourth argument that are all no less than 1 it should not return All stats should be no less than 1.
  • Failed:14. When create_character is called with a second, third or fourth argument that is higher than 4 it should return All stats should be no more than 4.
  • Passed:15. When create_character is called with a second, third and fourth argument that are all no more than 4 it should not return All stats should be no more than 4.
  • Failed:16. When create_character is called with a second, third or fourth argument that do not sum to 7 it should return The character should start with 7 points.
  • Passed:17. When create_character is called with a second, third and fourth argument that sum to 7 it should not return The character should start with 7 points.
  • Failed:18. create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
  • Failed:19. When create_character is called with valid values it should output the character stats as required.
reddit.com
u/Big_Example_3390 — 5 days ago