Welcome to Westonci.ca, your ultimate destination for finding answers to a wide range of questions from experts. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

Do you think we could use mathematical operators on string values rather than integers or floats? Explain.

Sagot :

Answer:

Yes and no. For example, you can do this:

print('hi' * 5)

Output:

hihihihihi

HOWEVER, you cannot do mathematical operations on strings. If I have a string "6" and try dividing it by 3, it's not going to work because... it's not an integer. While multiplying strings does work, you cannot actually do real math with strings unless you change them to int or float