What are the different data types?
- String: String data type is utilized to represent text in code, it must be placed between "" and can include the following
- Alphabet characters
- numbers
- spaces
- special characters such as
!@#$%&(*
- an example of a string in code is
phone = (123) 456-7890
print phone
- Integer: Integers is a whole number that can be positive or negative, for example, integers are usually utilized to depict the number of items available, temperature, and number of personnel.
- Float: Floats are numbers with decimal points, it can also be positive or negative. Examples of floats are weight
2.4 lbs.
, or volume of liquid12.2 oz.
- Boolean: This is a true or false statement based off of boolean logic.
- Array: an array is a data structure that represents a group of items/things. For example
myfamily = ["Natalie", "Jacob", "Caleb"]
print myfamily
- Hash/object: is a list of data that needs to be paired together. For example if you are working in a store and you want to list who is working on what cashier line you would list it like { "Lane 1" : "Mike Smith", "Lane 3" : "John Adams", "Lane 6" : "John Doe" }
This concludes the data types and my understanding of them, thank you for reading.