top of page
Search

PYTHON CODING

  • Writer: waclaw_koscielniak
    waclaw_koscielniak
  • Oct 2, 2025
  • 1 min read

import yfinance as yf

from datetime import datetime


symbol = input("Enter symbol: ").upper()

stock = yf.Ticker(symbol)


try:

price = stock.history(period="1d")["Close"].iloc[-1]

print(f"Current price of {symbol}: ${price:.2f}")


except IndexError:

print("Invalid stock symbole or data not available.")


current_datetime = datetime.now()

print(f"Current date and time: {current_datetime}")


python3 test835.py

Enter symbol: amzn

Current price of AMZN: $222.02

Current date and time: 2025-10-02 12:16:05.283174



Try to verify.
Try to verify.

















 
 
 

Recent Posts

See All

1 Comment


Guest
Oct 02, 2025

Try running it to check the current stock market price.

Like
bottom of page