Python Forum

Full Version: I see is that sys.argv contains character strings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
What is your question? Please edit the title and elaborate on the problem.
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)