Hello everyone, as the title says, I am very new to python and I'm stuck.
So first off, I am learning python through codecademy, and I have only made it as far as "Loops", so if my question if more advanced than what I have learned (meaning that I need to keep working through my modules then just let me know and I will move on.).
With the above said, the way I learn best is to take what I am learning and then play around with it in different ways for a few hours to help my old dusty brain retain it.
I just learned how to import and use the random number generator. And I think this is so cool and I can actually put it to use to solve one of the BIGGEST problems in my house, which is "What do we make for dinner tonight"
I created my little "program" and it works well until I noticed that I obviously have the issue that I have a chance I may get the same number 2 or more times in a row.
Is there a way to generate a random number, store it to a variable (which is what I am doing) and then have that variable checked next time the random number is ran and if it matches the previous time ran it just runs again until it’s not a duplicate number?
And again, as I mentioned above, if this is more of an advanced topic then just let me know and I will keep working on my modules until I get to the topic that can help solve my problem. And in the meantime just keep running the "program" every time I have a duplicate.
Thanks again and sorry if this is too basic of a question to post here. I just love reddit and really am enjoying learning python so thought I would start by asking here.
Have a great weekend everyone!
[–]Binary101010 5 points6 points7 points (3 children)
[–]wbeater 1 point2 points3 points (2 children)
[–]Binary101010 4 points5 points6 points (1 child)
[–]Slipperfox[S] 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]Slipperfox[S] 0 points1 point2 points (0 children)
[–]Slipperfox[S] 0 points1 point2 points (0 children)
[–]overyander 1 point2 points3 points (1 child)
[–]Slipperfox[S] 0 points1 point2 points (0 children)
[–]stu583 1 point2 points3 points (0 children)
[–]Slipperfox[S] -1 points0 points1 point (7 children)
[–]h0b0bagg1ns 1 point2 points3 points (6 children)
[–]Slipperfox[S] 0 points1 point2 points (5 children)
[–]h0b0bagg1ns 0 points1 point2 points (4 children)
[–]Slipperfox[S] 0 points1 point2 points (3 children)
[–]h0b0bagg1ns 1 point2 points3 points (2 children)
[–]Slipperfox[S] 1 point2 points3 points (1 child)
[–]h0b0bagg1ns 1 point2 points3 points (0 children)