This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sudoku Solver | |
# Nathan Esau | |
# May 27, 2015 | |
# 6x6 | |
import copy | |
strBoard1 = "216000300126000401143260000000030652" | |
strBoard2 = "003000400000500361601540024005000004" # can't solve yet | |
strBoard3 = "045160300000050621102340500216600000" | |
strBoard4 = "005600260000000012001060013200040053" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# q5 | |
n = input("Please enter a number: ") | |
msg = "" | |
for i in range(n): | |
msg = msg + str(i) + " " | |
print(msg) | |
# q6 | |
userStr = raw_input("Please enter a string: ") | |
userChar = raw_input("Please enter a character: ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function aduex(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double | |
aduex = (1 - Ax(x, A, B, c, w, i)) / (i / (1 + i)) | |
End Function | |
Function adueselectx(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double | |
adueselectx = (1 - Aselectx(x, A, B, c, w, i)) / (i / (1 + i)) | |
End Function | |
Function adueselectxplus1(x As Double, A As Double, B As Double, c As Double, w As Double, i As Double) As Double | |
adueselectxplus1 = (1 - Aselectxplus1(x, A, B, c, w, i)) / (i / (1 + i)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub PensionTable() | |
'Dim A As Double: A = Range("B2").Value | |
'Dim B As Double: B = Range("B3").Value | |
'Dim c As Double: c = Range("B4").Value | |
'Dim w As Double: w = Range("B5").Value | |
'Dim x As Double: x = Range("B6").Value | |
'Dim lx As Double: lx = Range("B7").Value | |
Dim A As Double: A = 0.00022 | |
Dim B As Double: B = 2.7e-06 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub PensionTable() | |
' Assume retirement age is 65 | |
'Dim A As Double: A = Range("B2").Value | |
'Dim B As Double: B = Range("B3").Value | |
'Dim c As Double: c = Range("B4").Value | |
'Dim w As Double: w = Range("B5").Value | |
'Dim x As Double: x = Range("B6").Value | |
'Dim lx As Double: lx = Range("B7").Value | |
Dim A As Double: A = 0.00022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### CMPT 120, HOMEWORK 2 ### | |
import math | |
# sum function is already defined. define sumsquares | |
def sumsquares(x): | |
total = 0 | |
for i in range(len(x)): | |
total = total + x[i]*x[i] | |
return(total) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
void brute_force_test(); | |
int is_permutation(int arr[], int n); | |
int* reverse(int *arr, int n); | |
int score(int arr[], int n); | |
void print(int arr[], int n); | |
int* make_perm(int n); | |
int factorial(int n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cmpt 130, Assignment 4 | |
* | |
* @author Nathan Esau (nesau@sfu.ca) | |
* @date 2014-03-14 21:26:18 | |
* @version 1.1 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cmpt 130, Assignment 3 | |
* | |
* @author Nathan Esau (nesau@sfu.ca) | |
* @date 2014-03-15 11:46:02 | |
* @version 1.0 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cmpt 130, Assignment 4 | |
* | |
* @author Nathan Esau (nesau@sfu.ca) | |
* @date 2014-03-14 21:26:18 | |
* @version 1.0 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |