I'm fairly new to coding, picking it up as a hobby, because its so far, fun, engaging, and challenging. Started out learning Python.
Just for the heck of it, I'm trying to write a function that will generate random integers, only print the even integers, and stop when it finally prints the number 28 (picked it at random.)
I've tried everything I could think of to get the function to loop, but the only thing I've been able to do successfully is just print out a single random even number once before the function stops.
Is there a way to have a function iterate through randint generated numbers between a user defined range, e.g.(0,x), and then apply if/elif/else's to the number(s) generated?
I've probably tried rewriting that same function 30-40 times, but I either get a single even number, a myriad of syntax errors, or some blue script that says "random.randint object at- and then a bunch of numbers.."???
Perhaps I just need to keep delving deeper into tutorials to find the answer, but this seemed like a more productive option. Perhaps there's something I'm not thinking of, or perhaps the concepts I need to employ I just haven't learned yet. Any advice/tips/actual lines of code GREATLY APPRECIATED!
Thanks in advance Mike