init
This commit is contained in:
1
python/personal/Garry.txt
Normal file
1
python/personal/Garry.txt
Normal file
@ -0,0 +1 @@
|
||||
obamna
|
||||
BIN
python/personal/__pycache__/pandas.cpython-311.pyc
Normal file
BIN
python/personal/__pycache__/pandas.cpython-311.pyc
Normal file
Binary file not shown.
122
python/personal/me learning python.py
Normal file
122
python/personal/me learning python.py
Normal file
@ -0,0 +1,122 @@
|
||||
# doing some things.
|
||||
x = 5.79
|
||||
y = int(x)
|
||||
print(y)
|
||||
|
||||
# printing length of str name with len() function
|
||||
name = " Nik is big poop face "
|
||||
print(len(name))
|
||||
|
||||
# finding and printing index 1 if str name as var z
|
||||
z = name[1]
|
||||
print(z)
|
||||
|
||||
# finding and printing index 2 through 5 of str name as var y
|
||||
y = name[2:5]
|
||||
print(y)
|
||||
|
||||
# replacing all "N" in str name with "P", after stripping blank space from the ends with var.strip()
|
||||
name = name.replace("N", "P")
|
||||
print(name.strip())
|
||||
|
||||
# {} is a placeholder, used for int age here
|
||||
age = 36
|
||||
txt = "My name is John, and I am {}"
|
||||
print(txt.format(age))
|
||||
|
||||
# this is true, becuase int age is not empty (its an int, not nothing)
|
||||
print(bool(age))
|
||||
|
||||
# this is false, because its an empty string (its nothing, not a string)
|
||||
print(bool(""))
|
||||
|
||||
# defining list body_parts, seeing if str "arm" is present in it, printing "hooray" if it is
|
||||
body_parts = ["arm", "leg"]
|
||||
if "arm" in body_parts:
|
||||
print("hooray")
|
||||
|
||||
### lists, bounded by [], can be modified. tuples, bounded by (), cannot.
|
||||
|
||||
# changing index 0 of list body_parts from "arm" to "pooper"
|
||||
body_parts[0] = "pooper"
|
||||
print(body_parts[0])
|
||||
|
||||
# appending "head" to list body_parts, then printing
|
||||
body_parts.append("head")
|
||||
print(body_parts)
|
||||
|
||||
# inserting str "butt" into index 3 of list body_parts
|
||||
body_parts.insert(3, "butt")
|
||||
print(body_parts)
|
||||
|
||||
# printing index -1 (the last one) of body_parts
|
||||
print(body_parts[-1])
|
||||
|
||||
# defining set computer_parts, and list more_computer_parts
|
||||
computer_parts = {"SSD", "CPU", "GPU"}
|
||||
more_computer_parts = ["RAM", "HDD", "AIO"]
|
||||
|
||||
# updating computer_parts, with more_computer_parts, printing updated list
|
||||
computer_parts.update(more_computer_parts)
|
||||
print(computer_parts)
|
||||
|
||||
# defining dict Truck, and its values
|
||||
Truck = {
|
||||
"model" : "Ranger",
|
||||
"year" : 2010,
|
||||
"make" : "Ford",
|
||||
"displacement" : 4.0,
|
||||
"transmission" : 5,
|
||||
"drivetrain" : "4x4"
|
||||
}
|
||||
|
||||
# printing Trucks "displacement" value
|
||||
print(Truck.get("displacement"))
|
||||
|
||||
# changing displacement value of dict Truck to 2.8, printing the changed value
|
||||
Truck["displacement"] = 2.8
|
||||
print(Truck.get("displacement"))
|
||||
|
||||
# setting a value, "color" in dict Truck, printing Truck's "color" value, the str "blue"
|
||||
Truck["color"] = "blue"
|
||||
print(Truck.get("color"))
|
||||
|
||||
# using the pop method to remove dict Truck's "transmission" value, printing the resulting dict
|
||||
Truck.pop("transmission")
|
||||
print(Truck)
|
||||
|
||||
# this line was typed on my thinkpad X395
|
||||
|
||||
X = 20
|
||||
Y = 20
|
||||
Z = 30
|
||||
|
||||
# logical operator stuff
|
||||
if X == Y:
|
||||
print("yes")
|
||||
|
||||
if X == Y and Y == Z:
|
||||
print("yes")
|
||||
|
||||
# while i < 6, add 1. once it reaches 6, stop adding, and print ("")
|
||||
i = 1
|
||||
while i < 6:
|
||||
print(i)
|
||||
i += 1
|
||||
else:
|
||||
|
||||
print("i is no longer less than 6")
|
||||
|
||||
# defining poopfunction
|
||||
def poopfunction():
|
||||
fruits = ["apple", "banana", "cherry", "Buthoal"]
|
||||
for x in fruits:
|
||||
if x == "apple":
|
||||
print(x)
|
||||
|
||||
# calling poopfunction
|
||||
poopfunction()
|
||||
|
||||
a = 2
|
||||
lambda a : a
|
||||
print(a)
|
||||
8
python/personal/pandas.py
Executable file
8
python/personal/pandas.py
Executable file
@ -0,0 +1,8 @@
|
||||
import numpy as np
|
||||
import scipy.stats as s
|
||||
import glob as glob # importing glob as glob
|
||||
import pandas as p
|
||||
|
||||
|
||||
x = 20
|
||||
print(x)
|
||||
8
python/personal/password.py
Normal file
8
python/personal/password.py
Normal file
@ -0,0 +1,8 @@
|
||||
password = open('Garry.txt')
|
||||
secret = password.read()
|
||||
print("Password?")
|
||||
query = input()
|
||||
if query == secret:
|
||||
print("correct!")
|
||||
else:
|
||||
print("NO NO THE ANSWER IS CUCUMBER")
|
||||
2
python/personal/peepee.py
Normal file
2
python/personal/peepee.py
Normal file
@ -0,0 +1,2 @@
|
||||
you = "peepee"
|
||||
print("you are a "+ you)
|
||||
13
python/personal/plt.py
Executable file
13
python/personal/plt.py
Executable file
@ -0,0 +1,13 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Let's have our x values just be a count from 0 to 49.
|
||||
var1 = np.arange(50)
|
||||
print(var1)
|
||||
|
||||
# And let's randomly generate some y values!
|
||||
var2 = var1 + 10*np.random.randn(50)
|
||||
|
||||
plt.scatter(var1,var2)
|
||||
|
||||
plt.show()
|
||||
12
python/personal/power_graph.py
Normal file
12
python/personal/power_graph.py
Normal file
@ -0,0 +1,12 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import io
|
||||
|
||||
f = open(".power_log", "r", encoding="utf-8")
|
||||
|
||||
data = f.readlines()
|
||||
x = np.arange(len(data))
|
||||
y = np.loadtxt(".power_log")
|
||||
|
||||
plt.plot(x,y)
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user