Position and context both matter:
• El niño cruza la calle solo → solo comes after the verb and refers back to the subject (the boy), so it means “alone.”
• If you wrote El niño solo cruza la calle, solo would precede the verb and most likely mean “only,” implying “the boy only crosses the street (and does nothing else).”
Modern Spanish no longer uses an accent on solo, even when it means “only,” so word order and context are your best clues.
• niño is masculine singular → article el
• valiente is an adjective that doesn’t change for gender (ends in -e), so it stays valiente for both masculine and feminine.
• calle is feminine singular → article la
• solo as “alone” here functions adverbially and stays invariable. If you used solo adjectivally before/after a noun (e.g. niño solo, niña sola), it would agree in gender.