I want to have something like this code from Python
num=3
res=str(num)
but in Maple. I couldn't find any appropriate constructors for this. Are there any?
I want to have something like this code from Python
num=3
res=str(num)
but in Maple. I couldn't find any appropriate constructors for this. Are there any?
The best way is to use convert as already exists in @acer's answer. Just to name one more possibility here is another way.
num := 3:
res := cat( "", num );
You will get "3" for res of type string. What cat here does is concatenating 3 to the empty string "", and when there exists at least one string in the arguments of cat, the output becomes a string. You can even have something like sqrt(2) instead of 3 in num, in that case res becomes this string; "2^(1/2)". But sometimes it may give you a non-string object, for example if the number in num is of the form RootOf. See the help page to read more.