05-19-2018, 12:12 PM
05-19-2018, 12:35 PM
Hello Mart,
I have done a new UK Lotto python script
.
Its actions are like a combination of the initial idea, and the first posted version above.
It is still 4 lines long, but is less typing, it doesn't need all the numbers to be typed out.
I also added to the output text that it is the lotto numbers.
I have also added more comment lines in the code to explain better what each part is doing.
![[Image: next.png]](https://preview.ibb.co/bMioT8/next.png)
Screenshot of new UK Lotto number picker running in terminal on Linux Lite, and also showing code in Gedit.
Here is the code, I saved it to a Leafpad document in Home folder and name it next.py
To run this open your terminal by holding down Ctrl and Alt keys and pressing t (Ctrl+Alt+t) .
Then copy/paste or type into terminal -
then press Enter key.
Side note - removed other linux topic not on topic in this thread.
I have done a new UK Lotto python script
. Its actions are like a combination of the initial idea, and the first posted version above.
It is still 4 lines long, but is less typing, it doesn't need all the numbers to be typed out.
I also added to the output text that it is the lotto numbers.
I have also added more comment lines in the code to explain better what each part is doing.
![[Image: next.png]](https://preview.ibb.co/bMioT8/next.png)
Screenshot of new UK Lotto number picker running in terminal on Linux Lite, and also showing code in Gedit.
Here is the code, I saved it to a Leafpad document in Home folder and name it next.py
Code:
# imports random function
import random
# labelling for lotto number output
print ("Your UK lotto numbers are - ")
# Picks 6 random numbers between 1 and 59
# range goes to 60 so that 59 is inclusive, 60 is not inclusive
# .sample does not duplicate numbers picked
# Outputs these 6 results in a list
print(random.sample(range(1, 60),6))
# interactivity - prints options
print ("You have Options - " "\nDonate a percentage of any wins to your favorite project" "\nDonate the stake instead to your favorite project")To run this open your terminal by holding down Ctrl and Alt keys and pressing t (Ctrl+Alt+t) .
Then copy/paste or type into terminal -
Code:
python next.pySide note - removed other linux topic not on topic in this thread.
05-19-2018, 12:56 PM
Hello,
using the second version of the UK Lotto above I have redone the EuroMillions Python script.
![[Image: eunext.png]](https://preview.ibb.co/iSNU1T/eunext.png)
EuroMillions new version with less typing, and improved comment lines, running on Linux Lite in Terminal and showing code in Gedit.
I save this to a Leafpad document in Home folder and named this eunext.py
Here is the code
To run this open terminal by holding down Ctrl and Alt keys and pressing t (Ctrl+Alt+t)
Then copy/paste or type
I hope you enjoyed reading this.
using the second version of the UK Lotto above I have redone the EuroMillions Python script.
![[Image: eunext.png]](https://preview.ibb.co/iSNU1T/eunext.png)
EuroMillions new version with less typing, and improved comment lines, running on Linux Lite in Terminal and showing code in Gedit.
I save this to a Leafpad document in Home folder and named this eunext.py
Here is the code
Code:
# imports random function
import random
# labelling for lotto number output
print ("Your EuroMillions numbers are - ")
# Picks 5 random numbers between 1 and 50
# range goes to 51 so that 50 is inclusive, 51 is not inclusive
# .sample does not duplicate numbers picked
# Outputs these 5 results in a list
print(random.sample(range(1, 51),5))
print ("Your Lucky Stars are - ")
print(random.sample(range(1, 13),2))
# interactivity - prints options
print ("You have Options - " "\nDonate a percentage of any wins to your favorite project" "\nDonate the stake instead to your favorite project")To run this open terminal by holding down Ctrl and Alt keys and pressing t (Ctrl+Alt+t)
Then copy/paste or type
Code:
python eunext.pyI hope you enjoyed reading this.
05-21-2018, 08:57 PM
Removed socially friendly infos above here to comply with, not on topic
Result at this stage is -
1/ producing the lotto numbers randomly as it is intended for.
2/ button click output is printing to terminal, not to my output box above button.Unsure what I am doing wrong in the code, I have tried pretty much every trial and error I can think of at this time, as just learning Python.
I will have another try at getting the numbers to appear in the output box, at a future time.
3/ the Donate button does nothing yet, I am unsure of the code to add for it to open the browser, I doubt this will be difficult so I leave it for last after fixing output.
Result at this stage is -
1/ producing the lotto numbers randomly as it is intended for.
2/ button click output is printing to terminal, not to my output box above button.Unsure what I am doing wrong in the code, I have tried pretty much every trial and error I can think of at this time, as just learning Python.
I will have another try at getting the numbers to appear in the output box, at a future time.
3/ the Donate button does nothing yet, I am unsure of the code to add for it to open the browser, I doubt this will be difficult so I leave it for last after fixing output.
05-28-2018, 07:35 PM
05-29-2018, 03:38 AM
Well done [member=411]bitsnpcs[/member] 

05-29-2018, 08:55 AM
Thank You [member=2]Jerry[/member]
05-30-2018, 02:42 PM
05-31-2018, 12:53 AM
05-31-2018, 01:58 AM
[member=411]bitsnpcs[/member]
That's very clever, great job!