I am trying to make a program for my college and I am stuck. My first problem is I have nothing in my console when I start the program. There should be some data from lista, but there is nothing. Second problem is I do not know how to make a single number from list items. I have to get two numbers, brojA and brojB. BrojA should be a number made by numbers from first part of the list items, and brojB should be a number from second part of items in list. Any ideas how to do that?
def fun(R):
lista = []
import random
for i in range(0, R+1):
a = random.randint(0, 9)
lista.append(a)
print(lista)
Here is the problem, when I call the method, there is nothing in list, but should be some numbers from for loop.
prviBr = []
drugiBr = lista
for i in range(0, lista.length()/2):
prviBr.append(lista[i])
drugiBr.remove(drugiBr[i])
brojA =
brojB =
And here I need to get two numbers from each part of list items.
def main():
ok = 0
while ok == 0:
R = int(input('Unesi broj: '))
if R % 2 == 0 and R > 7:
ok = 1
fun(R)
if __name__=='__main__':
main()
Its version 3.6 python.