0
can we declare system variables in phyton? like 2xy+3x in which x doest have value.
6 Réponses
+ 9
No we cannot do that since it will raise an error showing “variable x is not defined”. This is according to Python. I dont know about other languages.
+ 1
OOP would help a lot.
0
thank you bro .then how can i sove equations in mathematics .if we want to calculate the values of a equation .and also teach me how to get an input from uiser which contains both integers and characters .example :3x^2+6x-7
0
You need to program code to read strings such as "3x^²+6x-7" to do what you wanted them to do.
0
want to treat 3 as integer and x ^2 as string
0
You would make a list of lists, where:
"3x^2+6x-7" would be converted to:
[["x", 3, 2], ["x", 6, 1], [None, -7, 1]
where "x", "x" and None represent var names, 3, 6, -7 represent var multipliers and 2, 1 and 1 represent exponent.
Or something similar.