GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • w3resource
  • Front End
  • HTML
  • CSS
  • JavaScript
  • HTML5
  • Schema.org
  • php.js
  • Twitter Bootstrap
  • Responsive Web Design tutorial
  • Zurb Foundation 3 tutorials
  • Pure CSS
  • HTML5 Canvas
  • JavaScript Course

This view

  • Original page
  • New address

GeezerVison is showing www.w3resource.com — Python Projects: Display the daily Horoscope for a specified sign - w3resource

Python Projects: Display the daily Horoscope for a specified sign

Last update on September 18 2025 12:41:08 (UTC/GMT +8 hours)

Python Web Project-7 with Solution

Create a Python project to display the daily Horoscope for a specified sign.

Sample Output:

Input your Zodiac sign number:
 1. Aries
 2. Taurus
 3. Gemini
 4. Cancer
 5. Leo
 6. Virgo
 7. Libra
 8. Scorpio
 9. Sagittarius
 10. Capricorn
 11. Aquarius
 12. Pisces
Input a number from said list: 7
Choose some day:
 yesterday
 today
 tomorrow
Input the day from said list: yesterday
Jan 23, 2021 - There's passion in the air today, Libra. You can feel it. The feeling is so strong that the air almost pulsates. What are you going to do about it? If you're in a romantic relationship, plan an intimate evening together, free of chores and daily tasks. If you're single, peruse your little black book and see if there are any relationships worth warming up.

Sample Solution:

Python Code:

#Source:https://bit.ly/3pfYSJ6
import requests
from bs4 import BeautifulSoup
def horoscope(zodiac_sign: int, day: str) -> str:
    url = (
        "https://www.horoscope.com/us/horoscopes/general/"
        f"horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"
    )
    soup = BeautifulSoup(requests.get(url).content, "html.parser")
    return soup.find("div", class_="main-horoscope").p.text
if __name__ == "__main__":
    print("Daily Horoscope. \n")
    print(
        "Input your Zodiac sign number:\n",
        "1. Aries\n",
        "2. Taurus\n",
        "3. Gemini\n",
        "4. Cancer\n",
        "5. Leo\n",
        "6. Virgo\n",
        "7. Libra\n",
        "8. Scorpio\n",
        "9. Sagittarius\n",
        "10. Capricorn\n",
        "11. Aquarius\n",
        "12. Pisces\n",
    )
    zodiac_sign = int(input("Input a number from said list: ").strip())
    print("Choose some day:\n", "yesterday\n", "today\n", "tomorrow\n")
    day = input("Input the day from said list: ")
    horoscope_text = horoscope(zodiac_sign, day)
    print(horoscope_text)

Flowchart:

Flowchart: Display the daily Horoscope for a specified sign.

Go to:

  • Python Projects Home ↩
  • Python Projects Web programming ↩

Improve this sample solutions and post your code through Disqus



Follow us on Facebook and Twitter for latest update.


  • Daily Coding Challenges & Projects
  • Weekly Trends and Language Statistics



You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.