Python Pyaztro – Get lucky number

In this post we will be creating a Python script that will retrieve a lucky number based on a star sign, to do this will be using the Pyaztro library which is able to retrieve star sign information and return this in code. Star sign related information looks at the positions of moons, stars and planets on the premise that they have influence or can tell us about earthly events.

See the sample of Python code below where we use the Pyaztro library to retrieve a lucky number. The script will take a star sign as input from the user and return the relevant lucky number. We have also utilized a try and except block to cater for any input that is not recognised as a valid star sign.

import pyaztro
while True:
    star_sign=input("Please Enter your star sign: ")
        horoscope = pyaztro.Aztro(sign=star_sign)
        print("Lucky Number is...")
        print("Ooops, didnt recognise that star sign... \n")

Some example output for the above can be seen below.

Note – We have written this post for educational purposes only and any horoscopes/star sign information read does not the represent the views/opinions of Scriptopia.

Please Enter your star sign: libra
Lucky Number is...

Please Enter your star sign: aries
Lucky Number is...

Take a look at some of our other content around the Python programming language by clicking here.

Leave a Reply