Initial transfer of larger repo from git. IF full history and branches are needed must go to github at https://github.com/DulcisL/CCUCoding.git

This commit is contained in:
dolcel committed 2026-10-20 23:59:02 +00:00
commit c09ce40be0
4048 files changed
+603256

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
length = 0
str = []
while length < 5:
str.append(input("Input string here: "))
length += 1
if length == 5:
for x in str:
print (x)
list = []
for i in range(5):
list.append(input("Input string here: "))
for x in list:
print(x)
+24
View File
@@ -0,0 +1,24 @@
import numpy as np
#a = np.array( [2,5,10], dtype = np.int16)
#print(a)
#print("Length of one array element in bytes: ", a.itemsize,"Datatype: ", a.dtype)
#print("Total NP ARRAY size in bites :", a.itemsize *len(a))
#b = [2,5,10]
#import sys
#print(sys.getsizeof(b))
#a = np.arange(1,11,2)
#print(a)
#a = np.zeros(10)
#print(a, a.size, a.itemsize, a.dtype)
#a = np.ones(10)
#print(a, a.size, a.itemsize, a.dtype)
#a = np.empty(2) #random numbers
#print(a, a.size, a.itemsize, a.dtype)
+8
View File
@@ -0,0 +1,8 @@
import numpy as np
import matplotlib.pyplot as plt
xpoints = np.array([0,6])
ypoints = np.array([0,250])
plt.plot(xpoints,ypoints)
plt.show()
+4
View File
@@ -0,0 +1,4 @@
#This is my first program
x = 2
print("It works!")
@@ -0,0 +1,39 @@
print(0.1+0.1)
print(0.1+0.2)
print(3+2)
print(3-2)
print(3*2)
print(3**2)
print(3/2)
x=4/2
print(x)
print(type(x))
result = 2+3*4
print(result)
my_order = (2+3)*4
print(my_order)
my_str = "This is a string."
my_str2 = 'This is also a string.'
print(my_str)
print(type(my_str))
print(my_str2)
print(my_str[1])
#my_str[1] = 'q'
#print(my_str)
i = 9
print(i)
f = float(i)
print(f)
s = str(f)
print(s)
#print(int(abc))
@@ -0,0 +1,78 @@
from re import M
one = "String 1"
print(len(one))
two = ''
print(len(two))
print(one[1])
print(one[5])
my_str = "Monty Python"
print(my_str[-10])
print(my_str[-4])
print(my_str[0:4])
print(my_str[-13:-6])
print(my_str[-6:-1])
print(my_str[-1:-6])
print(my_str[-6:])
print(my_str[:5])
print(my_str[:])
print(my_str[-13:-6:2])
print(my_str[::2])
print(my_str[4:0:-1])
print(my_str)
#my_str[8] = 'Q'
new_str = my_str + 'X' + my_str
print(new_str)
x = 'This is a test'
y = x.split()
print(y)
print(x)
x = 'A lot of Spaces'
print(x.split())
y = 'Hello Python'
print(y.split(','))
sep = ':'
x = sep.join(['a','b'])
print(x)
a = 'X'
b = 'x'
c = ';'
print(a.islower())
print(b.islower())
print(c.islower())
print(a.upper())
print(b.upper())
print(c.upper())
print(y.find('o'))
print(y.find('on'))
print(y.find('g'))
print(y)
print(y.find('o',7))
print(y)
print(y.find('on',7,12))
print(y)
print(y.find('ell',1))
print(y.find('ell',2))
print(y)
print(y.lower().replace('o','X'))
print(y.lower().replace('o','X').split(','))
#print(y.lower().split(',').replace('o','X'))
+91
View File
@@ -0,0 +1,91 @@
myList = []
print(myList)
myTuple = ('Go', 5.6, 12)
myList = ['Hi', 2, 4.5]
print(myList)
print('----')
print(myList[0])
print('----')
print(myList[0:2])
print('----')
print(myTuple[0])
print('----')
print(myTuple[0:2])
myList = [1,2,3]
myList[1] = 5
print(myList)
print('----')
myTuple = (1,2,3)
#myTuple[1] = 27
#print(myTuple)
#Tuples could be used to store data that you don't want changed
#by a function
L1 = [1,2,3,4]
L2 = [1,2,4,5]
T1 = (6,7,8,9)
T2 = (6,7,9,10)
if 4 in L1:
print('yes')
if 4 in T1:
print('yes')
if L2 > L1:
print('List Greater')
if T2 > T1:
print('Tuple greater')
newList = list(T1)
print(newList)
newTuple = tuple(L1)
print(newTuple)
theList = []
print(theList)
theList.append('Yo')
print(theList)
theList.remove('Yo')
print(theList)
#theList.remove('X')
#print(theList)
#You could use an if statement using the count function
#to look for the thing you want to remove.
#theList.append(4,5)
#print(theList)
#I got an error saying that it can only take one argument
# this was given because you were giving it two arguments
myList = [1,2]
myList.extend([10,11])
print(myList)
print('----')
print(myList + [14,15])
myList.insert(0,'X')
print(myList)
#It added the elements to the beginning of the list.
myList.insert(len(myList),'Q')
print(myList)
myList = [1,2,3]
#myList.pop()
print(myList)
#pop removed the last element by default
val = myList.pop(1)
print(val)
print(myList)
#myList.pop(len(myList))
#If no value is found then 0 is returned.
+124
View File
@@ -0,0 +1,124 @@
myList = []
print(myList)
myTuple = ('Go', 5.6, 12)
myList = ['Hi', 2, 4.5]
print(myList)
print('----')
print(myList[0])
print('----')
print(myList[0:2])
print('----')
print(myTuple[0])
print('----')
print(myTuple[0:2])
myList = [1,2,3]
myList[1] = 5
print(myList)
print('----')
myTuple = (1,2,3)
#myTuple[1] = 27
#print(myTuple)
#Tuples could be used to store data that you don't want changed
#by a function
L1 = [1,2,3,4]
L2 = [1,2,4,5]
T1 = (6,7,8,9)
T2 = (6,7,9,10)
if 4 in L1:
print('yes')
if 4 in T1:
print('yes')
if L2 > L1:
print('List Greater')
if T2 > T1:
print('Tuple greater')
newList = list(T1)
print(newList)
newTuple = tuple(L1)
print(newTuple)
theList = []
print(theList)
theList.append('Yo')
print(theList)
theList.remove('Yo')
print(theList)
#theList.remove('X')
#print(theList)
#You could use an if statement using the count function
#to look for the thing you want to remove.
#theList.append(4,5)
#print(theList)
#I got an error saying that it can only take one argument
# this was given because you were giving it two arguments
myList = [1,2]
myList.extend([10,11])
print(myList)
print('----')
print(myList + [14,15])
myList.insert(0,'X')
print(myList)
#It added the elements to the beginning of the list.
myList.insert(len(myList),'Q')
print(myList)
myList = [1,2,3]
#myList.pop()
print(myList)
#pop removed the last element by default
#val = myList.pop(1)
#print(val)
#print(myList)
#myList.pop(len(myList))
print(myList)
myList.sort()
print(myList)
myList = [4,5,2,3,1,]
newList = sorted(myList)
print(myList)
print()
print(newList)
L = [1,2,3]
T = (4,5,6)
print(len(L))
print(min(L))
print(max(T))
print(sum(T))
my_list=[1,2,3,2,1]
my_tuple=(4,5,6,5,4)
print(my_list.count(3))
print(my_list.count(1))
print(my_list.count(4))
print(my_tuple.count(6))
print(my_tuple.count(4))
print(my_tuple.count(7))
#If the value isn't found then you get 0
myList = [1,2,3,2,1]
print(myList.index(3))
print(myList.index(1))
#print(myList.index(4))
#You get an error if the value isn't found
+31
View File
@@ -0,0 +1,31 @@
myList = []
name = input('Enter a Name: ')
while name != '':
myList.append(name)
name = input('Enter a name:')
print('\nName List:')
count = 0
i = 0
while i < len(myList):
print(myList[i])
if len(myList[i]) > 12:
count += 1
i += 1
print('\n', count, 'Long Names')
letters = ['a', 'b', 'c',]
numbers = [1, 2, 3]
i = 0
while i < len(letters):
j = 0
while j < len(numbers):
print('%s%d' % (letters[i], numbers[j]))
j+= 1
i += 1
print('Done')
# 1) The loop will never run.
# 2) You could use it but it may not work as well as a sentinel variable compared to something that is specifically for it
# 3) It would prevent J from resetting to run the nested loop whenever a new list was made.
@@ -0,0 +1,5 @@
import csv
f=open('data.csv')
reader = csv.reader(f,delimiter=',')
for row in reader:
print(row)
@@ -0,0 +1,12 @@
def my_func(text, *args):
print(len(args))
print('text',text)
print('arg2',args[0])
print('arg3',args[1])
print(type(args))
print('Start')
my_func('Function', 1, [1,3])
print('----')
my_func('Second Function',[2,6],2)
print('End')
+4
View File
@@ -0,0 +1,4 @@
Name,School,Major,Grade
Joe Cool,CCU,Psychology,A
Suzy Smart,Clemson,Education,B
Carl College,USC,Business,C
1 Name School Major Grade
2 Joe Cool CCU Psychology A
3 Suzy Smart Clemson Education B
4 Carl College USC Business C
@@ -0,0 +1,3 @@
Hello,
This is a file
The End!
@@ -0,0 +1,3 @@
Hello,
This is a file
The End!
@@ -0,0 +1,6 @@
my_list=[0, 1, 2, 3, 4]
for i, x in enumerate(my_list.copy()):
my_list[i]=10+x
print(x,'-->',my_list[i])
print(my_list)
@@ -0,0 +1,34 @@
import numpy as np
a = [1, 2, 3, 4]
x = np.array(a)
print(type(a))
print(type(x))
print(a)
print('----')
print(x)
x = np.zeros((4))
print(x)
y= np.full((2,2),27)
print(y)
z=y
print(z)
z[1][0]=34
print(y)
print(y)
y=y*10 # multiply every element in array by 10
print('---')
print(y)
z=y+y # add two arrays together
print('--')
print(z)
print(y)
print('---')
print(y.shape)
y.reshape((4))
print('---')
print(y)
+12
View File
@@ -0,0 +1,12 @@
import numpy as np
import matplotlib.pyplot as pl
x=np.array([1,2,3,4,5,6,7,8,9,10])
y=np.array([2,4,6,8,10,12,14,16,18,20])
pl.plot(x,y)
z=np.array([0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0])
pl.plot(x,z)
pl.show()
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
D = {'A': 1, 2: 'B', 'D': 3}
D[4] = [7, 8, 9]
D[5] = len
print(D)
len(D)
D[len] = 56
print(D)
X = [1,2]
print(D[X])