Omron HVC-P2 icon Omron HVC-P2 Omron HVC-P/HVC-P2 ARC plugin: Python-based camera integration for body, hand and face detection, gaze, age/gender, expressions and face recognition. Try it →
Tutorial
France
Published — Updated

Your Robot Gives You The Lottery Number (Python Language)

Here is a python script, which will give you the lottery numbers to play.


Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

(python language)

The program is planned for a draw of 5 numbers and a lucky number. (French lottery). You will need to change the lottery program in your country.

here is the python code:

import random

def loto():
     table1  = [(random.randint(1,49)), (random.randint(1,49)), (random.randint(1,49)), (random.randint(1,49)),(random.randint(1,49))]
     tablefin = []  
     doublon = []

     for i in table1:  
         if i not in tablefin:
             tablefin.append(i) #supprime les doublons
         else:
             doublon.append(i) #extraire les doublons
     d = len(doublon)
     while d > 0:
     #nouveau tirage
         doublon = []
         table1  = [(random.randint(1,49)), (random.randint(1,49)), (random.randint(1,49)), (random.randint(1,49)),(random.randint(1,49))]
         # recherche doublon
         for i in table1:
             if i not in tablefin:
                  tablefin.append(i) #supprime les doublons
             else:
                 doublon.append(i) #extraire les doublons
             # si il existe doublon d+1 et vide la table
             if (len(doublon)==1)or(len(doublon)==2)or(len(doublon)==3)or(len(doublon)==4)or(len(doublon)==5):       
                 talkBlocking("j ai trouver un doublon , je refais un tirage")
                 d = d+1
                 doublon =[]
             else:
                 d = 0
             break   
     # tri la table avant de la dire        
     table1.sort() 
     Audio.Say("Voci les numéros a jouer au loto .")
     Audio.Say("le "+str(table1[0]))
     Audio.Say("le "+str(table1[1]))
     Audio.Say("le "+str(table1[2]))
     Audio.Say("le "+str(table1[3]))
     Audio.Say("le "+str(table1[4]))
     Audio.Say("Et le numéro chance le, "+str(random.randint(1,9)))
     Audio.Say("Je vous souhaite bonne chance, ")
     
loto()

you will need to translate the sentences into the language of your country:

example: Audio.Say ("Here are the numbers to play the lotto.")

if you won, think of me, thank you ...

note : To make the EZROBOT micro-controller speak, replace Audio.Say by Audio.SayEZB . If you are interested in pthon programs, I can give you more here.


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

Author Avatar
Portugal
#1  

Nice. You have a inmoov?

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#3  

Wow how big is the big one? Or how small is the small one lol. Can’t tell by the photos but that’s real great!

#4   — Edited

hello, the small 1m13 and the big 1m80 .

My new project to replace the arduino with EZ-BV4, to make the little inmoov more autonomous.

Author Avatar
PRO
USA
#5  

can you translate that code into English?

#6  

What scale did you print the small guy at?

#8  

Hello EzAng

i don't speak english, i use google translate. To translate the sentences into English, just translate the sentences between quotes as well as the comments.

example :

recherche doublon. ==>

duplicate search

Audio.Say("Voci les numeros a jouer au loto .")==> Audio.Say ("Here are the numbers to play the lotto.")