from sys import argv script, number1, number2 = argv print("Here is your 1st number: ", number1) print("Here is your 2nd number: ", number2) product = number1 * number2 print(f"Here is your product: {product}") number3 = int(input("Enter your number: ")) last_ans = number3 * product print(f"Here is your final product times {number3}: ", last_ans)
I see is that sys.argv contains character strings
I see is that sys.argv contains character strings
|
Jan-09-2019, 09:46 AM
What is your question? Please edit the title and elaborate on the problem.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
It's normal, that sys.argv is a list which contains strings, what else do you expect?
Just convert the strings to integer or float before using them for calculation. product = int(number1) * int(number2)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians! |
|
Users browsing this thread: 2 Guest(s)