Comparing Digit Frequencies X63655


Statement
 

pdf   zip   main.py

Write a function compare_digits(p,q)compare\_digits(p, q) that tells whether every digit (non-negative integer less than 10) of pp occurs in qq at least as often as it occurs in pp. Borh pp and qq are positive integers.

Observation

Consider using as auxiliary function your (correct!) solution to X40706.

Sample session
>>> compare_digits(123, 321)
True
>>> compare_digits(1213, 33221)
False
>>> compare_digits(12, 22)
False
>>> compare_digits(314159, 112233456789)
True
Information
Author
Jordi Delgado \& José Luis Balcázar
Language
English
Official solutions
Python
User solutions
Python