Re-write the following staement after correction being made:
A=input(int("Enterthe value of A:"));
Answers
Answered by
12
A = int(input("Enter the value of A: "))
This is the correct statement.
Explanation:
- Original statement: A = input(int("Enter the value of A: "))
- Corrected statement: A = int(input("Enter the value of A: "))
When giving an input function, the data type must always be declared first before the input() clause.
When running the original cσde, it returns a Value Error:
Traceback (most recent call last):
File "<pyshell#49>", line 1, in <module>
A = input(int("Enter: "))
ValueError: invalid literal for int() with base 10: 'Enter: '
When running the corrected cσde, it runs without errors, enabling the user to input data into 'A' taking the form of an integer.
Similar questions