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
| #skilar einum staf mismunandi | |
| def main (): | |
| textfile = "advent2.txt" | |
| readfile = readtextfile(textfile) | |
| lineread = readlines(readfile) #["abcde","abcde","abxcd","abjcd","abcde"] | |
| linecount = 1 | |
| targetcount = 0 | |
| for i in range(0,len(lineread)): | |
| line = lineread[targetcount] |
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
| import numpy as np | |
| def advent(): | |
| nutlist = [] | |
| textfile = open("advent2.txt","r") | |
| for line in textfile: | |
| strippy = line.strip("\n") | |
| nutlist.append(strippy) | |
| #print(nutlist) |
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 advent(): | |
| nutlist = [] | |
| textfile = open("advent2.txt","r") | |
| for line in textfile: | |
| strippy = line.strip("\n") | |
| nutlist.append(strippy) | |
| #print(nutlist) | |
| return nutlist |
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
| import numpy as np | |
| def advent(): | |
| nutlist = [] | |
| textfile = open("advent2.txt","r") | |
| for line in textfile: | |
| strippy = line.strip("\n") | |
| nutlist.append(strippy) | |
| #print(nutlist) |
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
| my_int = 156 #int(input('Give me an int >= 0: ')) | |
| bstr = "" | |
| while my_int != 0: | |
| result = int(my_int/2) | |
| if int(my_int) is int(result+result): | |
| "0" += bstr | |
| my_int += int(-result) | |
| else: | |
| my_int = result |
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 Clock: | |
| def __init__(self,hours = 0,minutes = 0,seconds = 0): | |
| self.hours = hours | |
| self.minutes = minutes | |
| self.seconds = seconds | |
| def add_clocks(self,var1,var2,var3): | |
| self.hours = var1 | |
| self.minutes = var2 | |
| self.seconds = var3 |
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 Clock: | |
| def __init__(self,hours = 0,minutes = 0,seconds = 0): | |
| self.hours = hours | |
| self.minutes = minutes | |
| self.seconds = seconds | |
| def add_clocks(self,var1,var2,var3): | |
| self.hours = var1 | |
| self.minutes = var2 | |
| self.seconds = var3 |
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
| RANK = 0 | |
| NAME = 1 | |
| COUNTRY = 2 | |
| POINTS = 3 | |
| BIRTH_YEAR = 4 | |
| def get_input(user_prompt):## | |
| user_input = input(user_prompt) |
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
| RANK = 0 | |
| NAME = 1 | |
| COUNTRY = 2 | |
| POINTS = 3 | |
| BIRTH_YEAR = 4 | |
| def get_input(user_prompt):## | |
| user_input = input(user_prompt) |
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
| import string | |
| #a_str = "goat. in a boat. sometimes afloat, without a boat and a goat" | |
| #def string_to_list(a_string): | |
| #a_list = [] | |
| #for words in a_string.split(" "): | |
| #a_list.append(words) | |
| #print(a_list) | |
| #return a_list |