add a separate ppt (python version) for NIST_data_leakage02_winevt_xml

This commit is contained in:
Frank Xu
2023-09-16 17:56:25 -04:00
parent 9825a9c31f
commit eef36d8f31
6 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n",
"ubalt\n"
]
}
],
"source": [
"# Declare a variable and initialize it\n",
"a = 10\n",
"print(a)\n",
"# re-declaring the variable works\n",
"a = 'ubalt'\n",
"print(a)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x is greater than y\n",
"x is 10 and y is 1\n"
]
}
],
"source": [
"x,y =10,1\n",
"\n",
"if(x < y):\n",
"\tst= \"x is less than y\"\n",
"else:\n",
"\tst= \"x is greater than y\"\n",
"print (st)\n",
"print (\"x is {} and y is {}\".format(x,y))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Jan\n",
"Feb\n",
"Mar\n",
"April\n",
"May\n"
]
}
],
"source": [
"#use a for loop over a collection\n",
"months = [\"Jan\",\"Feb\",\"Mar\",\"April\",\"May\"]\n",
"# This is a set months = {'January', 'February', 'March', 'April'}\n",
"for m in months:\n",
"\tprint(m)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Jan\n",
"Feb\n"
]
}
],
"source": [
"# create a month set and \n",
"# use a for loop over the collection\n",
"month_set = set()\n",
"element1 = \"Jan\"\n",
"element2 = \"Feb\"\n",
"\n",
"month_set.add(element1)\n",
"month_set.add(element2)\n",
"\n",
"for m in month_set:\n",
"\tprint(m)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The square of 2 is 4.\n"
]
}
],
"source": [
"#define a function\n",
"def square(x):\n",
" \treturn x*x\n",
"\n",
"input = 2\n",
"output = square(input)\n",
"print(\"The square of {} is {}.\".format(input, output))"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"25\n"
]
}
],
"source": [
"# Import pymymodule as mm (an abbreviation)\n",
"import pymymodule as mm\n",
"\n",
"# Use the square function\n",
"result = mm.square(5)\n",
"print(result) # This will print: 25\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1 @@
The content will be overwritten each time!

View File

@@ -0,0 +1,3 @@
# define a function
def square(x):
return x * x