Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 2362

Hello how do i make 2 last numbers changes of a string PYTHON???

by DuckedoOnDrugs - 10 June, 2020 - 06:11 AM
This post is by a banned member (DuckedoOnDrugs) - Unhide
This post is by a banned member (Her) - Unhide
Her  
Angelic
2.213
Posts
412
Threads
6 Years of service
#2
keek
This post is by a banned member (clap) - Unhide
clap  
Godlike
519
Posts
134
Threads
5 Years of service
#3
(This post was last modified: 10 June, 2020 - 09:11 AM by clap.)
A simple way to do it is this. Note you will be getting a lot of duplicates as you're only changing the last 2 numbers. You need to take account for combinations, and where it limits out. You'll expect to get around 2,450 DIFFERENT numbers. After that, they'll just be duplicates.
Code:
import random
import string

#'1928MR006F' + ''.join(random.choice(string.digits) for x in range(2)) ~ Actual number generator

print('1928MR006F' + ''.join(random.choice(string.digits) for x in range(2))) # Printing it to the console
Always confirm via PM before dealing with me.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)