Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This script is intended to have the user input integers on the keyboard until a negative integer is an input, and then print the

This script is intended to have the user input integers on the keyboard until a negative integer is an input, and then print the product of all the positive values. Unfortunately, it does not work. Why? product = 1 s = input("Enter an integer: ") = int(s) while x < 0: if x > 0: product = s = input("Enter an integer: ") x = int(s) print(product)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Digital Logic With Verilog Design

Authors: Stephen Brown, Zvonko Vranesic

3rd Edition

978-0073380544, 0073380547

Students also viewed these Programming questions