Input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Input

So I wrote a little scrip to determine thing life income, tax, expences, profit, etc. of a company based on their production. The user is promted to input the number of priducts made, but when I type it into the console, the program will not work unless I input the number twice. Does anyone know why this is happening or how I can tix it? Thanks for the help

14th Jan 2018, 3:44 PM
Dank banker
Dank banker - avatar
5 Answers
+ 2
That's it! You are printing the first message asking for an input but this is not stored. But then you are correctly storing it (asking another input). So you can assign Widgets to the first line and erase the second one :) Another way is to "print" the first line instead "input" and let the second line how it is.
14th Jan 2018, 5:03 PM
Sebastián Zapata
Sebastián Zapata - avatar
+ 1
I am sure you have two "input()" in your code, and maybe one of them doesn't do anything. Can you show us your code please? We can help you more efficiently seeing it :)
14th Jan 2018, 4:06 PM
Sebastián Zapata
Sebastián Zapata - avatar
+ 1
Ah ok thanks for the help:)
14th Jan 2018, 5:24 PM
Dank banker
Dank banker - avatar
0
Here is what I wrote: input("How many widgets were made?\n") Widgets = int(input()) (Widgets is my variable for the number of products)
14th Jan 2018, 4:14 PM
Dank banker
Dank banker - avatar
0
Do you need to see more of the code or is that enough?
14th Jan 2018, 4:15 PM
Dank banker
Dank banker - avatar