This file contains hidden or 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
| def return_prime(num): | |
| prime = "is prime." | |
| not_prime = "is not prime." | |
| divisors = 0 | |
| if num > 1: | |
| for i in range(2,num): | |
| if (num % i) == 0: | |
| divisors = divisors + 1 |
This file contains hidden or 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
| List = [0,0,0,0,0,0,0,0,0] | |
| full_list = [] | |
| for i in range(0, len(List)): | |
| List[i] = 1 | |
| full_list.append(List[:]) | |
| List[i] = 0 |
This file contains hidden or 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
| green apple | |
| yellow flower | |
| red mitten | |
| happy days | |
| white river |
This file contains hidden or 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
| with open("test.txt", "w") as txtstm: | |
| txtlist = ("This ", "is ", "a ", "test.") | |
| for i in txtlist: | |
| txtstm.write(i) |
This file contains hidden or 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
| textstm = open("Inputstm.txt", 'w') | |
| textlist = ("This ", "is ", "a ", "test.") | |
| for i in textlist: | |
| textstm.write(i) | |
| textstm.close() |
This file contains hidden or 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
| def return_keys(*keys): | |
| ckeys = list(keys) | |
| return ckeys | |
| def return_values(*values): | |
| cvalues = list(values) |
This file contains hidden or 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
| class configure(object): | |
| def __init__(self, internal, external, figure): | |
| self.internal = internal | |
| self.external = external | |
| self.figure = figure | |
| def expo(self): | |
| try: | |
| self.external = self.internal ** self.figure |
This file contains hidden or 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
| class Stuff(object): | |
| def __init__(self, thing1, thing2, thing3): | |
| self.thing1 = thing1 | |
| self.thing2 = thing2 | |
| self.thing3 = thing3 | |
| def info(self): | |
| try: | |
| print("This is a thing:", self.thing1) | |
| print("This is also a thing:", self.thing2) | |
| print("This is another thing:", self.thing3) |
This file contains hidden or 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
| class Configure(object): | |
| def __init__(self, pointM, pointN): | |
| self.pointM = pointM | |
| self.pointN = pointN | |
| self.native = True | |
| def Points(self, M, N, n_): | |
| try: | |
| M = str(M) | |
| N = str(N) |
This file contains hidden or 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
| #Place a for loop inside of a funtion | |
| def numaricalForLoop(start, finish, increment): | |
| for i in range(start, finish, increment): | |
| print(i) | |
| numaricalForLoop(0, 20, 1) |
NewerOlder