0
What is the meaning of (!)
7 Answers
+ 2
Ah that is no operator but just a sign that is written to the screen!
print('Hello!')
leads to the output
'Hello!'
So whatever you put into quotes, is called a string - it is just a row of letters.
And you can combine strings with the + operator:
print('Hello ' + 'world!')
leads to the output
Hello world!
Two strings are tied together, that's all it is.
You should try it out for yourself in Playground and get a feeling for how it works.
+ 2
It means "NOT".
+ 1
x is a variable, where the sentence "This is a string" is stored. So in this case writing
print(x + '!')
is the same as writing
print('This is a string' + '!')
which is what I talked about above.
First, there was a number in x, but then it got overwritten with the string.
+ 1
Thanks
0
Deepanjali Das, in what context did you see it in Python?
0
In. Basic Concepts> Variables
0
Then how the (!) is used in the following code:-
https://code.sololearn.com/cCBSbtAL5yon/?ref=app