string and integer | Sololearn: Learn to code for FREE!


string and integer

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

12/1/2020 9:02:17 PM

Meriame Oubak

9 Answers

New Answer


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


That is stated in the first lessons of every course, and you already started the Python tutorial.


thank you guys and good luck💪🏻


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


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


but i didn't understand ir really :/

+2 Read the strings and variables lesson.


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


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