id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav1780@gmail.com 01_variables_and_operators > last_digits
prev  |  next  |  chance

Define a function that when passed an integer and the required number of least-significant digits, returns a number containing the required value. You can use math.pow(10, x) to get the required power of 10, because, without that, you'll need loops to solve this one.


last_digits(1729, 3) → 729
last_digits(1729, 10) → 1729
last_digits(92716174, 6) → 716174

...Save, Compile, Run (ctrl-enter)

def last_digits(n, d):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 1 Post-solution available

Copyright Nick Parlante 2017 - privacy