Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
395 changes: 395 additions & 0 deletions IntroToPython.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,395 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPOGUr6KJA2sDhU+eE3jOjr",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/TeeMajesty12/Portfolio/blob/main/IntroToPython.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "4r0sFwcRHllQ"
},
"outputs": [],
"source": [
"# Python Basics "
]
},
{
"cell_type": "markdown",
"source": [
"# Strings # the \"print()\""
],
"metadata": {
"id": "zInCUU31NLJa"
}
},
{
"cell_type": "code",
"source": [
"print(\"Hello World\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "H3prvfmOI6eI",
"outputId": "33e47cdc-ee98-4ffe-bee7-07006c53d540"
},
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Hello World\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"print(\"\\n\\t This Is The Tab Line\\nThis Is A Regular Line\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IXccpuDVJzLi",
"outputId": "69018cda-c2a5-4def-fd8c-5281a0d92a27"
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"\t This Is The Tab Line\n",
"This Is A Regular Line\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"print(\"first name \" + 'last name')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4IUMK5ogKNMl",
"outputId": "d70f2afe-80e9-48b8-9add-5554cbe6bf49"
},
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"first name last name\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"Variables"
],
"metadata": {
"id": "yrY9IlQYMI4n"
}
},
{
"cell_type": "markdown",
"source": [
"# Variable"
],
"metadata": {
"id": "tBJPq-meMbMb"
}
},
{
"cell_type": "code",
"source": [
"dogs = 3\n",
"cats = \"Many Of These Cats\""
],
"metadata": {
"id": "8E8N2GRAMju_"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## More Strings"
],
"metadata": {
"id": "V6gnqTzqNy42"
}
},
{
"cell_type": "code",
"source": [
"greeting = \"Hello World!\" ; "
],
"metadata": {
"id": "d4DilXBoN1p_"
},
"execution_count": 6,
"outputs": []
},
{
"cell_type": "code",
"source": [
"print(greeting[3])\n",
"print(greeting[6])\n",
"print(greeting[2])\n",
"\n",
"## This Prints Out The Individual Letter Of The Greeting"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "cpQ3vBi8OAnE",
"outputId": "841aae61-61e4-4f4f-eff8-1b14ee31dea9"
},
"execution_count": 12,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"l\n",
"W\n",
"l\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"greeting[-1]\n",
"\n",
"## Using \"-1\" Will Automatically Print The Last Letter (Or Character) Of The Greeting.\n",
"## \"-1\" Basically Just Means To Start From The End"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"id": "fFKlEJcUOAdT",
"outputId": "764ed6ff-aa7e-4e90-ba9b-754c9d30dad0"
},
"execution_count": 13,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'!'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 13
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "LCck0IOvOAPP"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## String Formatting"
],
"metadata": {
"id": "opZ9pImUP1yr"
}
},
{
"cell_type": "code",
"source": [
"price = 59.99"
],
"metadata": {
"id": "ieYmilwzP4Ic"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"price\n",
"message = \"The Product Costs \" + str(price) + \"Dollars\"\n",
"print(message)\n",
"## I added \"str()\" to the price because float and srtings can't compile together"
],
"metadata": {
"id": "yZ_nCeXgP-GG"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## The .format() method!!"
],
"metadata": {
"id": "8q1_EpTHROuY"
}
},
{
"cell_type": "code",
"source": [
"price = 59.99\n",
"msg = \"The product cost {} dollars \" .format(price)\n",
"print(msg)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "eoGk35N6Qqwp",
"outputId": "b232184d-9a58-4101-cc70-8f6c590e6786"
},
"execution_count": 17,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"The product cost 59.99 dollars \n"
]
}
]
},
{
"cell_type": "code",
"source": [
"amount = 3\n",
"total = amount * price\n",
"\n",
"msg2 = \"For {} Products at the price of {}, the total will be: {}\"\n",
"\n",
"print(msg2.format(amount, price, total))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "iUky-Z5FRUU8",
"outputId": "ac4f18f5-0c70-40a3-ced5-8d5a326ad8e5"
},
"execution_count": 19,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"For 3 Products at the price of 59.99, the total will be: 179.97\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"msg3 = \"For {2} products at the price of {0}, the total is {1}\"\n",
"\n",
"print(msg3.format(amount, price, total))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "YXAH1zmKSxri",
"outputId": "c12c1e90-a6ab-44d7-cf4a-fd19f51aeb8f"
},
"execution_count": 22,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"For 179.97 products at the price of 3, the total is 59.99\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"## The f-string method!!!\n"
],
"metadata": {
"id": "Y7UxBECRTN6g"
}
},
{
"cell_type": "code",
"source": [
"price = 19.99\n",
"items = 3"
],
"metadata": {
"id": "b5-k5jPBTUXN"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"msg = f\"This indivu=idual product is {price}\""
],
"metadata": {
"id": "PI0V0GAPTZS0"
},
"execution_count": 23,
"outputs": []
}
]
}
Binary file added images/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading