Skip to content

Instantly share code, notes, and snippets.

@robertorodriguez12
Last active May 27, 2020 19:12
Show Gist options
  • Save robertorodriguez12/8c78d54e392305479d3b7addbe380bca to your computer and use it in GitHub Desktop.
Save robertorodriguez12/8c78d54e392305479d3b7addbe380bca to your computer and use it in GitHub Desktop.

Software_Coding

Beginners Guide to Data Types

In this Gist, we will have a quick overview of different data types and what they are used for.

What are the different data types?

  1. 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
  1. 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.
  2. 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 liquid 12.2 oz.
  3. Boolean: This is a true or false statement based off of boolean logic.
  4. Array: an array is a data structure that represents a group of items/things. For example
myfamily = ["Natalie", "Jacob", "Caleb"]
print myfamily
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment