0

Can someone please help me with strings

3rd Nov 2016, 9:06 PM
Kunal Mehta
Kunal Mehta - avatar
2 Answers
+ 1
what do you need to know? Strings are basically just a bunch of characters bundled together. they are usually used to enter words into the program (such as declaribg a string variable to ask someone's name; getting input from the user as to what their name is and then entering a greeting with their name (this is very basic and strings can be used for much more than that, entering data in databases, gathering information, etc..)) Another example would be the search and replace function in a program. you enter a "string" of characters (a word or phrase) to search for, and another word to replace. the program searches for the first string that you have entered and replaces it with the second.
3rd Nov 2016, 10:21 PM
Frédéric Charette
Frédéric Charette - avatar
0
Strings are a data type that require a ' at the beginning and end. To print a string for example, print('hello world') Output: hello world. Strings can be numbers as well, but it is important to understand the difference between strings and ints when doing any type of math. For example: This equation adds two numbers of the int data type. print(5 + 5) Output: 10 This equatiom adds two numbers of the string data type. print('5' + '5') Output: 55
4th Nov 2016, 5:53 AM
Matt Helm