string and integer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

string and integer

please what they mean by (string) and (integer), a simple explecation please im just a beginner 🙏🏻❤️

1st Dec 2020, 9:02 PM
Meriame Oubak
Meriame Oubak - avatar
8 Answers
+ 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
3rd Dec 2020, 2:44 PM
Priyanshi
Priyanshi - avatar
+ 4
thank you guys and good luck💪🏻
3rd Dec 2020, 2:50 PM
Meriame Oubak
Meriame Oubak - avatar
+ 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
1st Dec 2020, 9:12 PM
Jayakrishna 🇮🇳
+ 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
1st Dec 2020, 10:50 PM
Mahad Ahmed
Mahad Ahmed - avatar
+ 2
but i didn't understand ir really :/
1st Dec 2020, 9:11 PM
Meriame Oubak
Meriame Oubak - avatar
1st Dec 2020, 10:37 PM
Samira
Samira - avatar
+ 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
2nd Dec 2020, 11:17 PM
Israel Sal
Israel Sal - avatar
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
2nd Dec 2020, 12:14 AM
Benjamin Jürgens
Benjamin Jürgens - avatar