Think of a math problem.
Judging from "it rains in the afternoon and it is always sunny in the morning", it is impossible to rain in the morning and afternoon at the same time. The time to describe the weather in the title is 5 afternoons, 6 mornings, 7 mornings or afternoons. There is a morning and an afternoon every day, so the number of days Xiao Ming stays at his grandmother's house is (5+6+7) divided by 2=9 (days).