Skip to content

Instantly share code, notes, and snippets.

@computer-tutor
Created April 28, 2020 05:51
Show Gist options
  • Save computer-tutor/4fa15ca2c263829e8ea64d9521e49822 to your computer and use it in GitHub Desktop.
Save computer-tutor/4fa15ca2c263829e8ea64d9521e49822 to your computer and use it in GitHub Desktop.
from random import randint
def random_n_digit(n):
range_start = 10**(n-1)
range_end = (10**n)-1
return randint(range_start,range_end)
print('Random number of digit 3 is', random_n_digit(3))
print('Random number of digit 5 is', random_n_digit(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment