BestPromptFinder
HomeCoding › Below is an instruction that describes a task. Write a respo...

Below is an instruction that describes a task. Write a respo...

Coding · General · Coding
42Quality
90%Useful
87Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Program a web scraper in Python to extract the latest stock prices from specific websites. ### Input: ["AAPL stocks", "MSFT stocks", "FB stocks", "GOOG stocks"] ### Output: import requests from bs4 import BeautifulSoup # input stocks = ["AAPL stocks", "MSFT stocks", "FB stocks", "GOOG stocks"] # process def get_stock_price(stock): url = f" response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') price = soup.find('div', {'class': 'My(6px) Pos(r) smartphone_Mt(6px)'}).find('span').text return price # output for stock in stocks: price = get_stock_price(stock) print(f'The price of {stock} is {price}.')
Find similar in the app →

Why this prompt

Source

Hugging Face

Related Coding prompts

PRD to MVP Technical Plan
Quality 93 · Claude Code
Full-Stack CRUD App Builder
Quality 93 · Claude Code
Legacy Refactor Planner
Quality 93 · Claude Code
Test Suite Generator
Quality 93 · Claude Code
Third-Party API Integration
Quality 93 · Claude Code
Database Schema and Migration
Quality 93 · Claude Code