Nov-27-2023, 12:46 AM
hello.
I got what I want in excel but it fades away so I thought I shoul try Python to do following:
Read 4 random numbers one by one, into a b c d until two conditions (a = 9 and b =20) is true.
Code attached refuse to use the logical and. It works like a logical or instead (stop running when one of conditions is achieved.
As a none repetition and using bytes (none values above 254), I have a feeling another function/methode might fit better?
Will execution of program run faster by using bytes instead of integers?
I got what I want in excel but it fades away so I thought I shoul try Python to do following:
Read 4 random numbers one by one, into a b c d until two conditions (a = 9 and b =20) is true.
Code attached refuse to use the logical and. It works like a logical or instead (stop running when one of conditions is achieved.
As a none repetition and using bytes (none values above 254), I have a feeling another function/methode might fit better?
Will execution of program run faster by using bytes instead of integers?
import tkinter
from random import randint
a=0
b=0
c=0
d=0
root_tk = tkinter.Tk()
window = root_tk
window.geometry("19x12+0+0")
window.minsize(19, 12)
while (a != 9) and (b != 20):
a=0
b=0
c=0
d=0
a = randint(1,16)
b = randint(13,29)
c = randint(16,34)
d = randint(22,40)
print(a,b,c,d)
window.mainloop()[output][Running] python -u "d:\Python311\Scripts\randi.py"
9 26 18 31
[Done] exited with code=1 in 9.924 seconds
[Running] python -u "d:\Python311\Scripts\randi.py"
5 20 31 40
[Done] exited with code=1 in 5.363 seconds[/output]
