Skip to content

Instantly share code, notes, and snippets.

@computer-tutor
Created April 28, 2020 05:51
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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