CHALLENGE ACTIVITY 5.5.1: For loop: Printing a list Write an expression to print each price in stock prices. Sample outp…

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

CHALLENGE ACTIVITY 5.5.1: For loop: Printing a list Write an expression to print each price in stock prices. Sample output with inputs: 34.62 76.30 85.05 $ 34.62 $ 76.30 $ 85.05 1 # NOTE: The following statement converts the input into a list container 2 stock_prices – input().split() 5 4 for “solution goes here”: print(‘s’, price) Run TL

in progress 0
admin 6 months 2023-04-07T05:49:11+00:00 1 Answer 0 views Teacher 0

Answer ( 1 )

    0
    2023-04-07T05:49:11+00:00

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    Here’s the code to print each price in stock_prices list with a dollar sign:

    scss

    stock_prices = input().split()
    for price in stock_prices:
    print(‘$’, price)

    Sample Output:

    ruby

    34.62 76.30 85.05
    $ 34.62
    $ 76.30
    $ 85.05

Leave an answer

Browse

By answering, you agree to the Terms of Service and Privacy Policy.