Python Forum
Working with Random Generated Numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with Random Generated Numbers
#3
(Sep-09-2019, 08:54 PM)SheeppOSU Wrote: For separating the the the random number, you can simply turn it into a string and get the two numbers. Here's an example put into a function.
def Num_Sep(number):
    strNum = str(number) #Turn the number into a string because strings are made of arrays allowing for the number to be taken apart.
    numberArray = [] #The list to send back the numbers in.
    for character in strNum:
        numberArray.append(int(character)) #Add the number to the list as an int value.
    
    return numberArray #Return the numbers of the number in a list.
Hope this helps!


Thanks SheepOSU for the help, I am going to try and implement it, I am still very new to coding, like I started past Thursday with a software engineering bootcamp from scratch ive never touched coding before so its all very new and foreign to me and takes me a while to digest it but I am sure I will figure it out with your advice I appreciate it big time SheepOSU! :)
Reply


Messages In This Thread
RE: Working with Random Generated Numbers - by YoungGrassHopper - Sep-09-2019, 09:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "Random" module is not working as expected Genericgamemaker 1 935 Jul-25-2024, 04:46 PM
Last Post: Gribouillis
  random numbers, randint janeik 2 1,568 Nov-27-2023, 05:17 PM
Last Post: janeik
  HOW TO USE C# GENERATED DLL davide_vergnani 2 3,203 Jun-12-2023, 03:35 PM
Last Post: davide_vergnani
  find random numbers that are = to the first 2 number of a list. Frankduc 23 7,044 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  List of random numbers astral_travel 17 5,658 Dec-02-2022, 10:37 PM
Last Post: deanhystad
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 2,787 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  random.uniform is not working correctly dron4ik86 9 6,134 Feb-06-2020, 03:04 PM
Last Post: dron4ik86
  output a list of random numbers 'x' columns wide adityavpratap 4 3,914 Jan-13-2020, 05:32 PM
Last Post: perfringo
  Can i prevent the random generator to generate already used numbers? MauserMan 3 3,790 Jan-05-2020, 04:44 PM
Last Post: MauserMan
  Finding MINIMUM number in a random list is not working Mona 5 4,391 Nov-18-2019, 07:27 PM
Last Post: ThomasL

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020