mercredi 18 novembre 2020

list object has no attribute split and lots of other error

Im trying to ask the user to set a minimum and max value and then ask how many random numbers they want to put in the list in the range they set. Im really new to programming and have no clue if im even close to doing this correctly.

import random

liste_x = []
liste_y = []

def random_pkt():
    length = input("What should minimum and max value be? write as: x,y. or exit")
    while (length != "exit"):
        length = length.split(",")
        minimum = int(length[0])
        maks = int(length[1])
    datapoint = input("How many random data do you want? or exit")
    while (datapoint != "exit"):
        for i in range(datapoint):
            liste_x.append(str(random.randint(minimum, maks)))
            liste_y.append(str(random.randint(minimum, maks)))
        datapoint = input("How many random data do you want? or exit")
    return liste_x, liste_y

random_pkt()



Aucun commentaire:

Enregistrer un commentaire