+ 2
string and integer
please what they mean by (string) and (integer), a simple explecation please im just a beginner 🙏🏻❤️
8 Respuestas
+ 5
Anything which is written between double quotes "" is string in python str and all negative, positive numbers including zero is integer also called int.
Eg -
>>> "I am String"
'I am String'
>>> -5 # a int
-5
+ 4
thank you guys and good luck💪🏻
+ 3
String "sequence of characters" represented in single quote like 'str' or double quotes like "str" in python...
Integer : whole numbers ex : -1,-4,0, 4444,77777777777777
+ 3
Any number (positive or negative) is called integer
Like 10 or -5 or 0 or 100000
x = 5
We can say x is a integer variable
Or a variable whose value is integer 5
If you have decimal point value it become float
y = 4.3
And here y is a float
In simple words, Any text is a string if it is letters, numbers, special charactors, etc
But we assign string inside a single ' or double quotes "
message = "hi!"
here message is a string
Message = "123"
It also remain a string because it is surrounded by a quotes
Python assume it as a text
In python integers are refer as int
And string are refer as str
+ 2
but i didn't understand ir really :/
+ 2
https://www.sololearn.com/Course/JUMP_LINK__&&__Python__&&__JUMP_LINK/?ref=app
Read the strings and variables lesson.
+ 1
In python, string is any text in between quotes.
e.g x = "45"
Here, 45 is a string because its between quotes.
They are represented by str in python
Integers are just positive or negative whole numbers.
They are represented by int in python
0
String is for text
Integer is for numbers. Used for calculations (+, -, *, / etc.)
Integer can store only whole numbers. For fractional numbers like 0.5, 3.141 etc. you need to use float