+ 2
why string have two definition?
A string is composed of numbers, characters, or symbols. second A string is an ordered sequence of characters.
2 ответов
+ 1
Yes its both definitions combined.. A String is an ordered sequence of characters that can consist of letters, numbers and symbols.
0
you can read it like this
definition == a string is an ordered sequence of characters.
sidenote == these characters can be any letter, symbol or number.
the important thing to take away here is is that a string isn’t just letters. it is a set of characters that can be anything, so also numbers or the + sign.
but when you use these characters as a string they don’t “mean” anything to the programme.
eg
print(“1+1”) #between “” is a string
#output: 1+1
print(1+1) #this is not a string just numbers used by the programme
#output: 2