Coding challenge

An integer $x$ is chosen randomly between $10\le x\le 99$, via x=math.random(10,99). If all choices are equally likely, write some code to find the probability that at least one digit of $x$ is a 7. Hint: use getdigit(x,n) to return the n$^{th}$ digit from the right of a number x. Ex: getdigit(1234,2) returns 3. (Ref: ACM 12B 2/25/2004.)

Type your code here:


Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: