The mayor and city council of a city of the first class shall have power to provide for keeping the sidewalks clean and free from obstructions and accumulations of snow, ice, mud, and slush, and may provide for the assessment and collection of taxes on real estate and for the sale and conveyance thereof to pay expenses of keeping the sidewalks adjacent to such real estate clean and free from obstructions and accumulations of snow, ice, mud, and slush, and the mayor and city council shall also have power to provide that the violation of the ordinance relative thereto shall give rise to a cause of action for damages in favor of any person who is injured by the failure or neglect of the owner and occupant of the real estate to comply with the ordinance in question.