├── .DS_Store ├── Chapter01 └── ch1_hello_world.py ├── Chapter02 ├── ch2_compound_interest.py ├── ch2_conditions.py ├── ch2_input.py ├── ch2_input_rounded.py └── ch2_party.py ├── Chapter03 ├── ch3_cateringdict.py ├── ch3_cateringdict2.py ├── ch3_cateringdict3.py ├── ch3_finiteness.py ├── ch3_nameprompt.py ├── ch3_officelunch.py ├── ch3_statecapitals1.py ├── ch3_statecapitals2.py ├── ch3_statecapitals3.py └── ch3_statecapitals4.py ├── Chapter04 ├── ch4_andOperator.py ├── ch4_if-elif-elseStatement.py ├── ch4_if-elseStatement.py ├── ch4_ifStatement.py ├── ch4_inductiveP1.py ├── ch4_logicError.py ├── ch4_nestedStatements.py ├── ch4_notOperator.py └── ch4_orOperator.py ├── Chapter05 ├── ch5_Error1.py ├── ch5_Error1_fixed.py ├── ch5_Error2.py ├── ch5_Error2_fixed.py ├── ch5_Error3.py ├── ch5_buggyCode1.py ├── ch5_buggyCode1_solution.py ├── ch5_buggyCode2.py ├── ch5_buggyCode2_solution.py ├── ch5_typeError.py └── ch5_typeError2.py ├── Chapter06 ├── ch6_guess1.py ├── ch6_guess2.py ├── ch6_guess3.py ├── ch6_guess4.py ├── ch6_storeCost.py ├── ch6_storeDictionary.py ├── ch6_storePersonalize.py ├── ch6_storeQuantities.py └── ch6_storeTotals.py ├── Chapter07 ├── ch7_Pizzeria.py ├── ch7_Pizzeria2.py └── ch7_sleep.py ├── Chapter08 ├── ch8_debugger.py ├── ch8_debugger2.py ├── ch8_debugger3.py ├── ch8_errors.py ├── ch8_evenalgorithm1.py ├── ch8_evenalgorithm2.py ├── ch8_pets1.py ├── ch8_pets2.py ├── ch8_pets3.py ├── ch8_syntaxerror1.py ├── ch8_syntaxerror2.py └── ch8_syntaxerror3.py ├── Chapter09 ├── ch9_BookLibrary.py ├── ch9_Iterations.py ├── ch9_SquareLoops.py ├── ch9_Sums.py ├── ch9_Sums2.py ├── ch9_absFunction.py ├── ch9_addressBook.py ├── ch9_colorLoop.py ├── ch9_dictionary1.py ├── ch9_dictionary2.py ├── ch9_dictionary3.py ├── ch9_evenNumbers.py ├── ch9_evenNumbers2.py ├── ch9_files1.py ├── ch9_list1.py ├── ch9_list2.py ├── ch9_list3.py ├── ch9_list4.py ├── ch9_mammals.py ├── ch9_nameFunction.py ├── ch9_reverse.py ├── ch9_survey.txt ├── ch9_surveyData.py ├── ch9_surveyData2.py ├── ch9_variables.py ├── ch9_variables2.py └── ch9_whileLoop.py ├── Chapter10 ├── ch10_input1.py ├── ch10_input2.py ├── ch10_input3.py ├── ch10_input4.py ├── ch10_input5.py ├── ch10_problem1.py ├── ch10_problem2.py └── ch10_problem3.py ├── Chapter11 ├── ch11_forLoop1.py ├── ch11_forLoop2.py ├── ch11_forLoop3.py ├── ch11_forLoop4.py ├── ch11_functions1.py ├── ch11_functions2.py ├── ch11_functions3.py ├── ch11_functions4.py ├── ch11_functions5.py ├── ch11_functions6.py ├── ch11_rollDice.py ├── ch11_whileLoop1.py ├── ch11_whileLoop2.py └── ch11_whileLoop3.py ├── Chapter12 ├── ch12_pledgesA.py ├── ch12_pledgesB.py ├── ch12_pledgesC.py └── ch12_pledgesTemplate.py ├── Chapter13 ├── ch13_global.py ├── ch13_local.py ├── ch13_sample1.py └── ch13_sample2.py ├── Chapter14 ├── ch14_abbreviate.py ├── ch14_csvAnalysis.py ├── ch14_csvAnalysis_2.py ├── ch14_csvAnalysis_3.py ├── ch14_data.csv ├── ch14_matplotlib.py ├── ch14_pairplotSNS.py ├── ch14_pdDataFrame.py └── ch14_seabornSample.py ├── Chapter15 ├── ch15_BIRCH.py ├── ch15_KMeans.py ├── ch15_diabetesA.py ├── ch15_diabetesB.py ├── ch15_syntheticDataset.py └── diabetes.csv ├── Chapter16 ├── ch16_binning1.py ├── ch16_binning2.py ├── ch16_cleaningDemo1.py ├── ch16_cleaningDemo2.py ├── ch16_cleaningDemo3.py ├── ch16_cleaningDemo4.py ├── ch16_cleaningDemo5.py ├── ch16_cleaningDemo6.py ├── ch16_csvDemo.py ├── ch16_housePrice_prediction.py ├── ch16_housePrice_prediction2.py ├── ch16_seriesDemo.py ├── ch16_seriesDemo2.py ├── ch16_seriesDemo3.py ├── ch16_seriesDemo4.py ├── demo.csv ├── demo_missing.csv └── kc_house_data.csv ├── Chapter17 ├── ch17_MLK-IHaveADream.txt ├── ch17_chatBot.py ├── ch17_cryptographyA.py ├── ch17_hashing.py ├── ch17_historicalTextAnalysis.py ├── ch17_readability.py ├── ch17_storyTime.py ├── ch17_travel.py ├── ch17_webscraping.py ├── intents.json └── pudgy.PNG ├── Chapter18 ├── Ch18_languageDetection.py ├── Data_Cortex_Nuclear.csv ├── VZ.csv ├── breast-cancer.csv ├── brooklyn_sales_map.zip ├── ch18_BreastCancerSample.py ├── ch18_CNN_mnist.py ├── ch18_CovidPR.py ├── ch18_CovidPR_2.py ├── ch18_boxplot.py ├── ch18_electricFieldLines.py ├── ch18_housingBrooklyn.py ├── ch18_pairplots.py ├── ch18_predictionsModel.py ├── ch18_stockAnalysis.py ├── ch18_tessellation.py ├── dataset.csv └── us-PuertoRico.csv ├── Chapter18_languageDetection.py ├── Chapter19 └── readme.md ├── LICENSE └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Applied-Computational-Thinking-with-Python-Second-Edition/b8399777f44ab8b2ea65e5c1e2a1be658f66f76a/.DS_Store -------------------------------------------------------------------------------- /Chapter01/ch1_hello_world.py: -------------------------------------------------------------------------------- 1 | print('Hello World!') 2 | -------------------------------------------------------------------------------- /Chapter02/ch2_compound_interest.py: -------------------------------------------------------------------------------- 1 | P = float(input("How much are you planning on depositing? ")) 2 | r = float(input("At what monthly compound rate will it be paid out? ")) 3 | t = float(input("How many years will the money be deposited? ")) 4 | #Convert the rate to a decimal for the formula by dividing by 100 5 | r = r/100 6 | A = P * (1 + r/12)**(12*t) 7 | A = round(A, 2) 8 | print("Total after " + str(t) + " years: ") 9 | print(A) 10 | -------------------------------------------------------------------------------- /Chapter02/ch2_conditions.py: -------------------------------------------------------------------------------- 1 | h=input("Enter your height in inches: ") 2 | total = (int(h)/0.069)*0.25 3 | total = round(total,2) 4 | if total == 250: 5 | print("Your height in quarters is the same as $250.") 6 | elif total > 250: 7 | total = str(total) 8 | print("Your height in quarters is more than $250. It is $" + total) 9 | else: 10 | print("You're short, so choose the $250.") 11 | 12 | -------------------------------------------------------------------------------- /Chapter02/ch2_input.py: -------------------------------------------------------------------------------- 1 | h=input("Enter your height in inches: ") 2 | total = (int(h)/0.069)*0.25 3 | print(total) 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter02/ch2_input_rounded.py: -------------------------------------------------------------------------------- 1 | h=input("Enter your height in inches: ") 2 | total = (int(h)/0.069)*0.25 3 | print(round(total,2)) 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Chapter02/ch2_party.py: -------------------------------------------------------------------------------- 1 | k = int(input("How many children are coming to the party? ")) 2 | T = 12 * k 3 | if T == 200: 4 | print("You are right on budget, at " + str(T)) 5 | elif T <= 200: 6 | print("You are under budget, at " + str(T)) 7 | else: 8 | print("You are over budget, at " + str(T)) 9 | -------------------------------------------------------------------------------- /Chapter03/ch3_cateringdict.py: -------------------------------------------------------------------------------- 1 | catering_menu = { 2 | "sandwiches": 8.50, 3 | "salads": 7.95 4 | } 5 | print(catering_menu) 6 | 7 | -------------------------------------------------------------------------------- /Chapter03/ch3_cateringdict2.py: -------------------------------------------------------------------------------- 1 | catering_menu = { 2 | "sandwiches": 8.50, 3 | "salads": 7.95 4 | } 5 | catering_menu["salads"] = 9.50 6 | print(catering_menu) 7 | 8 | -------------------------------------------------------------------------------- /Chapter03/ch3_cateringdict3.py: -------------------------------------------------------------------------------- 1 | catering_menu = { 2 | "sandwiches": 8.50, 3 | "salads": 7.95 4 | } 5 | catering_menu["salads"] = 9.50 6 | catering_menu["soup"] = 3.75 7 | print(catering_menu) 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Chapter03/ch3_finiteness.py: -------------------------------------------------------------------------------- 1 | i = 0 2 | while i < 15: 3 | i += 1 4 | print(i) 5 | 6 | -------------------------------------------------------------------------------- /Chapter03/ch3_nameprompt.py: -------------------------------------------------------------------------------- 1 | name = input("Hello traveler. What is your name? ") 2 | print(f"Hello, {name}. Welcome to the adventure!") 3 | -------------------------------------------------------------------------------- /Chapter03/ch3_officelunch.py: -------------------------------------------------------------------------------- 1 | #Ask the user for the number of sandwich meals ordered and save as variable. 2 | number_of_sandwiches = int(input("How many sandwich lunches were ordered? ")) 3 | #Ask the user for the number of salad meals ordered and save as variable. 4 | number_of_salads = int(input("How many salad lunches were ordered? ")) 5 | #Create total_cost variable and save the algorithm for total the new variables. 6 | total_cost = 8.50 * number_of_sandwiches + 7.95 * number_of_salads 7 | #Print the total cost. Don't forget to convert the total_cost to string. 8 | print("The total cost for the employee lunch is $" + str(total_cost) + ".") 9 | -------------------------------------------------------------------------------- /Chapter03/ch3_statecapitals1.py: -------------------------------------------------------------------------------- 1 | Ohio = "Columbus" 2 | Alabama = "Montgomery" 3 | Arkansas = "Little Rock" 4 | 5 | print(Ohio) 6 | -------------------------------------------------------------------------------- /Chapter03/ch3_statecapitals2.py: -------------------------------------------------------------------------------- 1 | state_capitals = { 2 | "Ohio" : "Columbus", 3 | "Alabama" : "Montgomery", 4 | "Arkansas" : "Little Rock" 5 | } 6 | 7 | print(state_capitals["Ohio"]) 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Chapter03/ch3_statecapitals3.py: -------------------------------------------------------------------------------- 1 | state_capitals = { 2 | "Ohio" : "Columbus", 3 | "Alabama" : "Montgomery", 4 | "Arkansas" : "Little Rock" 5 | } 6 | 7 | state = input("What state's capital are you looking for today? ") 8 | capital = state_capitals[state] 9 | 10 | 11 | print("The capital of " + state + " is " + capital + ".") 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Chapter03/ch3_statecapitals4.py: -------------------------------------------------------------------------------- 1 | state_capitals = { 2 | "Ohio" : "Columbus", 3 | "Alabama" : "Montgomery", 4 | "Arkansas" : "Little Rock" 5 | } 6 | state_capitals["Iowa"] = "Des Moines" 7 | 8 | state = input("What state's capital are you looking for today? ") 9 | capital = state_capitals[state] 10 | 11 | 12 | print("The capital of " + state + " is " + capital + ".") 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Chapter04/ch4_andOperator.py: -------------------------------------------------------------------------------- 1 | number = int(input("Give a number between 1 and 200. ")) 2 | if number > 99 and number % 2 == 0: 3 | print("That's a large, even number.") 4 | elif number > 99 and number % 2 != 0: 5 | print("That's a large, odd number.") 6 | elif number < 100 and number % 2 == 0: 7 | print("That's a small, even number.") 8 | else: 9 | print("That's a small, odd number.") 10 | -------------------------------------------------------------------------------- /Chapter04/ch4_if-elif-elseStatement.py: -------------------------------------------------------------------------------- 1 | number = int(input("Pick a number between 1 and 20. ")) 2 | if number < 10: 3 | print("That's less than 10.") 4 | elif number < 21: 5 | print("That's between 10 and 20.") 6 | else: 7 | print("That number isn't between 0 and 20. Run the program and try again.") 8 | -------------------------------------------------------------------------------- /Chapter04/ch4_if-elseStatement.py: -------------------------------------------------------------------------------- 1 | number = int(input("What's your favorite number? ")) 2 | if number < 100: 3 | print("That's not a very large number.") 4 | else: 5 | print("I guess you like large numbers.") 6 | 7 | -------------------------------------------------------------------------------- /Chapter04/ch4_ifStatement.py: -------------------------------------------------------------------------------- 1 | number = int(input("What's your favorite number? ")) 2 | if number < 100: 3 | print("That's not a very large number.") 4 | -------------------------------------------------------------------------------- /Chapter04/ch4_inductiveP1.py: -------------------------------------------------------------------------------- 1 | #We need the math module, so don't forget to import it. 2 | import math 3 | #Ask the user if they will be inputing pencils or erasers first. 4 | item1 = input("Will you be entering pencils or erasers? ") 5 | 6 | if item1 == "pencils": 7 | pencils = int(input("How many pencils will you purchase? ")) 8 | if pencils * 1.75 < 150: 9 | pencilstotal = pencils * 1.75 10 | total = 150 - pencilstotal 11 | total = total / 1.50 12 | erasers = math.floor(total) 13 | total2 = pencilstotal + erasers * 1.50 14 | print("You will be able to purchase " + str(pencils) + " pencils and " + str(erasers) + " erasers for a total cost of $" + str(total2) + ".") 15 | else: 16 | print("That's too many pencils.") 17 | elif item1 == "erasers": 18 | erasers = int(input("How many erasers will you purchase? ")) 19 | if erasers * 1.50 < 150: 20 | eraserstotal = erasers * 1.50 21 | total = 150 - eraserstotal 22 | total = total / 1.75 23 | pencils = math.floor(total) 24 | total2 = pencils * 1.75 + eraserstotal 25 | print("You will be able to purchase " + str(pencils) + " pencils and " + str(erasers) + " erasers for a total cost of $" + str(total2) + ".") 26 | else: 27 | print("That's too many erasers.") 28 | else: 29 | print("Please run the program again and enter erasers or pencils as your input.") 30 | 31 | 32 | -------------------------------------------------------------------------------- /Chapter04/ch4_logicError.py: -------------------------------------------------------------------------------- 1 | number = int(input("Pick a number between 1 and 20. ")) 2 | if number < 10: 3 | if number < 6: 4 | print("Why such a small number?") 5 | else: 6 | print("Well, less than 10 but greater than 5. I'll take it.") 7 | if number < 21: 8 | if number < 16: 9 | print("You like values that are greater than 10, but not too much greater. I guess that's fine.") 10 | else: 11 | print("I like larger numbers myself too.") 12 | else: 13 | print("That number isn't between 0 and 20. Run the program and try again.") 14 | -------------------------------------------------------------------------------- /Chapter04/ch4_nestedStatements.py: -------------------------------------------------------------------------------- 1 | number = int(input("Pick a number between 1 and 20. ")) 2 | if number < 10: 3 | if number < 6: 4 | print("Why such a small number?") 5 | else: 6 | print("Well, less than 10 but greater than 5. I'll take it.") 7 | elif number < 21: 8 | if number < 16: 9 | print("You like values that are greater than 10, but not too much greater. I guess that's fine.") 10 | else: 11 | print("I like larger numbers myself too.") 12 | else: 13 | #Sometimes we make mistakes when providing input in programs. If you choose a number that's not between 0 and 20, the program will print this message. 14 | print("That number isn't between 0 and 20. Run the program and try again.") 15 | -------------------------------------------------------------------------------- /Chapter04/ch4_notOperator.py: -------------------------------------------------------------------------------- 1 | A = True 2 | B = False 3 | print(not A) 4 | print(not B) 5 | print(not (A and B)) 6 | print(not (A or B)) 7 | -------------------------------------------------------------------------------- /Chapter04/ch4_orOperator.py: -------------------------------------------------------------------------------- 1 | A = True 2 | B = False 3 | C = A and B 4 | D = A or B 5 | if C == True: 6 | print("A and B is True.") 7 | else: 8 | print("A and B is False.") 9 | if D == True: 10 | print("A or B is True.") 11 | else: 12 | print("A or B is False.") 13 | 14 | -------------------------------------------------------------------------------- /Chapter05/ch5_Error1.py: -------------------------------------------------------------------------------- 1 | number = int(input("Type the number of fries you are ordering: ")) 2 | 3 | cost = 1.50 4 | 5 | total = number * number 6 | 7 | print("Your total cost is $" + str(total) + ".") 8 | -------------------------------------------------------------------------------- /Chapter05/ch5_Error1_fixed.py: -------------------------------------------------------------------------------- 1 | number = int(input("Type the number of fries you are ordering: ")) 2 | 3 | cost = 1.50 4 | 5 | total = cost * number 6 | 7 | print("Your total cost is $" + str(total) + ".") 8 | -------------------------------------------------------------------------------- /Chapter05/ch5_Error2.py: -------------------------------------------------------------------------------- 1 | number = int(input("Give a number between 1 and 200. ")) 2 | if number > 99 and number % 2 == 0: 3 | print("That's a large, even number.") 4 | elif number > 99 and number % 2 != 0: 5 | print("That's a large, odd number.") 6 | elif number < 100 and number % 2 == 0: 7 | print("That's a small, even number.") 8 | else: 9 | print("That's a small, odd number.") 10 | -------------------------------------------------------------------------------- /Chapter05/ch5_Error2_fixed.py: -------------------------------------------------------------------------------- 1 | number = int(input("Give a number between 1 and 200. ")) 2 | if number > 99 and number % 2 == 0: 3 | print("That's a large, even number.") 4 | elif number > 99 and number % 2 != 0: 5 | print("That's a large, odd number.") 6 | elif number < 100 and number % 2 == 0: 7 | print("That's a small, even number.") 8 | else: 9 | print("That's a small, odd number.") 10 | -------------------------------------------------------------------------------- /Chapter05/ch5_Error3.py: -------------------------------------------------------------------------------- 1 | number = int(input("Give a number between 1 and 200. ")) 2 | if number > 99 and number % 2 == 0: 3 | print("That’s a large, even number.") 4 | elif number > 99 and number % 2 != 0: 5 | print("That’s a large, odd number.") 6 | elif number < 100 and number % 2 == 0: 7 | print("That’s a small, even number.") 8 | else: 9 | print("That’s a small, odd number.") 10 | -------------------------------------------------------------------------------- /Chapter05/ch5_buggyCode1.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | for i in range(0, 10): 4 | n = random.randint(0, 5) 5 | print(in) 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter05/ch5_buggyCode1_solution.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | for i in range(0, 10): 4 | n = random.randint(0, 5) 5 | print(i*n) 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter05/ch5_buggyCode2.py: -------------------------------------------------------------------------------- 1 | firstNumber = int(input('Enter a number between 1 and 3: ')) 2 | secondNumber = int(input('Enter a number between 8 and 15: ')) 3 | 4 | sum1 = firstNumber + secondNumber 5 | 6 | print("I predict your number is less than 19, in this case", sum1) 7 | 8 | -------------------------------------------------------------------------------- /Chapter05/ch5_buggyCode2_solution.py: -------------------------------------------------------------------------------- 1 | firstNumber = int(input('Enter a number between 0 and 3: ')) 2 | 3 | if(firstNumber < 4): 4 | secondNumber = int(input('Enter a number between 8 and 15: ')) 5 | if(secondNumber > 7 and secondNumber < 16): 6 | sum1 = firstNumber + secondNumber 7 | print("I predict your number is less than 19, in this case", sum1) 8 | else: 9 | print("Run this again and pay attention to the numbers!") 10 | else: 11 | print("Run this again and pay attention to the numbers!") 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Chapter05/ch5_typeError.py: -------------------------------------------------------------------------------- 1 | number = input("Write a number between 1 and 10. ") 2 | 3 | print(10 / number) 4 | 5 | -------------------------------------------------------------------------------- /Chapter05/ch5_typeError2.py: -------------------------------------------------------------------------------- 1 | number = input("Write a number between 1 and 10. ") 2 | 3 | print(10 / int(number)) 4 | 5 | -------------------------------------------------------------------------------- /Chapter06/ch6_guess1.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | compnumber = rand.randint(1, 100) 3 | print(compnumber) 4 | 5 | usernumber = int(input("Choose a number between 1 and 100. You'll get 5 guesses or you lose! ")) 6 | print(usernumber) 7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter06/ch6_guess2.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | compnumber = rand.randint(1, 100) 3 | usernumber = int(input("Choose a number between 1 and 100. You'll get 5 guesses or you lose! ")) 4 | 5 | if compnumber == usernumber: 6 | print("You win!") 7 | else: 8 | print("You lose!") 9 | -------------------------------------------------------------------------------- /Chapter06/ch6_guess3.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | compnumber = rand.randint(1, 100) 3 | i = 5 4 | for number in range(5): 5 | usernumber = int(input("Choose a number between 1 and 100. You have " + str(i) + " guesses left. ")) 6 | if compnumber == usernumber: 7 | print("You win!") 8 | else: 9 | i = i - 1 10 | 11 | print("You're out of guesses! You lose! ") 12 | 13 | -------------------------------------------------------------------------------- /Chapter06/ch6_guess4.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | compnumber = rand.randint(1, 100) 3 | i = 5 4 | for number in range(5): 5 | usernumber = int(input("Choose a number between 1 and 100. You have " + str(i) + " guesses left. ")) 6 | if compnumber == usernumber: 7 | print("You win!") 8 | exit() 9 | elif compnumber > usernumber: 10 | print("Your number is too small!") 11 | i = i - 1 12 | elif compnumber < usernumber: 13 | print("Your number is too large!") 14 | i = i - 1 15 | print("You're out of guesses! You lose! ") 16 | 17 | -------------------------------------------------------------------------------- /Chapter06/ch6_storeCost.py: -------------------------------------------------------------------------------- 1 | online_store = { 2 | "keychain": 0.75, 3 | "tshirt": 8.50, 4 | "bottle": 10.00 5 | } 6 | 7 | choicekey = int(input("How many keychains will you be purchasing? If not purchasing keychains, enter 0. ")) 8 | choicetshirt = int(input("How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. ")) 9 | choicebottle = int(input("How many t-shirts will you be purchasing? If not purchasing water bottles, enter 0. ")) 10 | 11 | print("You are purchasing " + str(choicekey) + " keychains, " + str(choicetshirt) + " t-shirts, and " + str(choicebottle) + " water bottles.") 12 | 13 | if choicekey > 9: 14 | online_store['keychain'] = 0.65 15 | if choicetshirt > 9: 16 | online_store['tshirt'] = 8.00 17 | if choicebottle > 9: 18 | online_store['bottle'] = 8.75 19 | 20 | keychain = online_store['keychain'] 21 | tshirt = online_store['tshirt'] 22 | bottle = online_store['bottle'] 23 | 24 | print(online_store) 25 | -------------------------------------------------------------------------------- /Chapter06/ch6_storeDictionary.py: -------------------------------------------------------------------------------- 1 | online_store = { 2 | "keychain": 0.75, 3 | "tshirt": 8.50, 4 | "bottle": 10.00 5 | } 6 | print(online_store) 7 | -------------------------------------------------------------------------------- /Chapter06/ch6_storePersonalize.py: -------------------------------------------------------------------------------- 1 | online_store = { 2 | "keychain": 0.75, 3 | "tshirt": 8.50, 4 | "bottle": 10.00 5 | } 6 | 7 | choicekey = int(input("How many keychains will you be purchasing? If not purchasing keychains, enter 0. ")) 8 | choicetshirt = int(input("How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. ")) 9 | choicebottle = int(input("How many t-shirts will you be purchasing? If not purchasing water bottles, enter 0. ")) 10 | 11 | if choicekey > 9: 12 | online_store['keychain'] = 0.65 13 | if choicetshirt > 9: 14 | online_store['tshirt'] = 8.00 15 | if choicebottle > 9: 16 | online_store['bottle'] = 8.75 17 | 18 | print("You are purchasing " + str(choicekey) + " keychains, " + str(choicetshirt) + " t-shirts, and " + str(choicebottle) + " water bottles.") 19 | 20 | perskey = input("Will you personalize the keychains for an additional $1.00 each? Type yes or no. ") 21 | perstshirt = input("Will you personalize the t-shirts for an additional $5.00 each? Type yes or no. ") 22 | persbottle = input("Will you personalize the water bottles for an additional $7.50 each? Type yes or no. ") 23 | 24 | if perskey == ("yes" or "Yes"): 25 | online_store['keychain'] = online_store['keychain'] + 1.00 26 | if perstshirt == ("yes" or "Yes"): 27 | online_store['tshirt'] = online_store['tshirt'] + 5.00 28 | if persbottle == ("yes" or "Yes"): 29 | online_store['bottle'] = online_store['bottle'] + 7.50 30 | 31 | keychain = online_store['keychain'] 32 | tshirt = online_store['tshirt'] 33 | bottle = online_store['bottle'] 34 | 35 | totalkey = choicekey * keychain 36 | totaltshirt = choicetshirt * tshirt 37 | totalbottle = choicebottle * bottle 38 | grandtotal = totalkey + totaltshirt + totalbottle 39 | 40 | print("Keychain total: $" + str(totalkey)) 41 | print("T-shirt total: $" + str(totaltshirt)) 42 | print("Water bottle total: $" + str(totalbottle)) 43 | print("Your order total: $" + str(grandtotal)) 44 | 45 | 46 | -------------------------------------------------------------------------------- /Chapter06/ch6_storeQuantities.py: -------------------------------------------------------------------------------- 1 | online_store = { 2 | "keychain": 0.75, 3 | "tshirt": 8.50, 4 | "bottle": 10.00 5 | } 6 | keychain = online_store['keychain'] 7 | tshirt = online_store['tshirt'] 8 | bottle = online_store['bottle'] 9 | 10 | choicekey = input("How many keychains will you be purchasing? If not purchasing keychains, enter 0. ") 11 | choicetshirt = input("How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. ") 12 | choicebottle = input("How many t-shirts will you be purchasing? If not purchasing water bottles, enter 0. ") 13 | 14 | print("You are purchasing " + str(choicekey) + " keychains, " + str(choicetshirt) + " t-shirts, and " + str(choicebottle) + " water bottles.") 15 | 16 | -------------------------------------------------------------------------------- /Chapter06/ch6_storeTotals.py: -------------------------------------------------------------------------------- 1 | online_store = { 2 | "keychain": 0.75, 3 | "tshirt": 8.50, 4 | "bottle": 10.00 5 | } 6 | 7 | choicekey = int(input("How many keychains will you be purchasing? If not purchasing keychains, enter 0. ")) 8 | choicetshirt = int(input("How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. ")) 9 | choicebottle = int(input("How many t-shirts will you be purchasing? If not purchasing water bottles, enter 0. ")) 10 | 11 | if choicekey > 9: 12 | online_store['keychain'] = 0.65 13 | if choicetshirt > 9: 14 | online_store['tshirt'] = 8.00 15 | if choicebottle > 9: 16 | online_store['bottle'] = 8.75 17 | 18 | keychain = online_store['keychain'] 19 | tshirt = online_store['tshirt'] 20 | bottle = online_store['bottle'] 21 | 22 | print("You are purchasing " + str(choicekey) + " keychains, " + str(choicetshirt) + " t-shirts, and " + str(choicebottle) + " water bottles.") 23 | totalkey = choicekey * keychain 24 | totaltshirt = choicetshirt * tshirt 25 | totalbottle = choicebottle * bottle 26 | grandtotal = totalkey + totaltshirt + totalbottle 27 | 28 | print("Keychain total: $" + str(totalkey)) 29 | print("T-shirt total: $" + str(totaltshirt)) 30 | print("Water bottle total: $" + str(totalbottle)) 31 | print("Your order total: $" + str(grandtotal)) 32 | 33 | 34 | -------------------------------------------------------------------------------- /Chapter07/ch7_Pizzeria.py: -------------------------------------------------------------------------------- 1 | #Get input for your variables for size and sauce first. 2 | 3 | size_choice = str(input("Is this a personal or family pizza? Type personal or family. ")) 4 | 5 | sauce_choice = str(input("Which sauce would you like? Marinara or garlic cream? Type m for marinara and g for garlic cream. ")) 6 | if sauce_choice == "g": 7 | sauce = "garlic cream" 8 | else: 9 | sauce = "marinara" 10 | 11 | #The cheese choice will dictate a few more options. Define the variable first. 12 | cheese_choice = str(input("Would you like cheese on your pizza? Type y for yes and n for no. ")) 13 | 14 | #Toppings need to happen whether or not you want cheese. 15 | if cheese_choice == "y": 16 | cheese2_choice = str(input("Would you like regular cheese or extra cheese? Type r for regular and e for extra cheese. ")) 17 | if cheese2_choice == "r": 18 | cheese = "regular cheese" 19 | else: 20 | cheese = "extra cheese" 21 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 22 | if toppings1_input == "y": 23 | toppings1 = "mushrooms" 24 | else: 25 | toppings1 = "no mushrooms" 26 | else: 27 | cheese = "no cheese" 28 | 29 | 30 | if cheese_choice == "n": 31 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 32 | if toppings1_input == "y": 33 | toppings1 = "mushrooms" 34 | else: 35 | toppings1 = "no mushrooms" 36 | 37 | 38 | print("You want a " + size_choice + " pizza with " + sauce + " sauce, " + cheese + ", and " + toppings1 + ".") 39 | -------------------------------------------------------------------------------- /Chapter07/ch7_Pizzeria2.py: -------------------------------------------------------------------------------- 1 | #Get input for your variables for size and sauce first. 2 | 3 | size_choice = str(input("Is this a personal or family pizza? Type personal or family. ")) 4 | 5 | sauce_choice = str(input("Which sauce would you like? Marinara or garlic cream? Type m for marinara and g for garlic cream. ")) 6 | if sauce_choice == "g": 7 | sauce = "garlic cream" 8 | else: 9 | sauce = "marinara" 10 | 11 | #The cheese choice will dictate a few more options. Define the variable first. 12 | cheese_choice = str(input("Would you like cheese on your pizza? Type y for yes and n for no. ")) 13 | 14 | #Toppings need to happen whether or not you want cheese. 15 | if cheese_choice == "y": 16 | cheese2_choice = str(input("Would you like regular cheese or extra cheese? Type r for regular and e for extra cheese. ")) 17 | if cheese2_choice == "r": 18 | cheese = "regular cheese" 19 | else: 20 | cheese = "extra cheese" 21 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 22 | if toppings1_input == "y": 23 | toppings1 = "mushrooms" 24 | else: 25 | toppings1 = "no mushrooms" 26 | else: 27 | cheese = "no cheese" 28 | 29 | 30 | if cheese_choice == "n": 31 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 32 | if toppings1_input == "y": 33 | toppings1 = "mushrooms" 34 | else: 35 | toppings1 = "no mushrooms" 36 | 37 | ready_end = str(input("Do you need to make any changes? Type y for yes and n for no. ")) 38 | if ready_end == "y": 39 | size_choice = str(input("Is this a personal or family pizza? Type 1 for personal and 2 for family. ")) 40 | 41 | sauce_choice = str(input("Which sauce would you like? Marinara or garlic cream? Type m for marinara and g for garlic cream. ")) 42 | if sauce_choice == "g": 43 | sauce = "garlic cream" 44 | else: 45 | sauce = "marinara" 46 | 47 | cheese_choice = str(input("Would you like cheese on your pizza? Type y for yes and n for no. ")) 48 | 49 | if cheese_choice == "y": 50 | cheese2_choice = str(input("Would you like regular cheese or extra cheese? Type r for regular and e for extra cheese. ")) 51 | if cheese2_choice == "r": 52 | cheese = "regular cheese" 53 | else: 54 | cheese = "extra cheese" 55 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 56 | if toppings1_input == "y": 57 | toppings1 = "mushrooms" 58 | else: 59 | toppings1 = "no mushrooms" 60 | else: 61 | cheese = "no cheese" 62 | 63 | 64 | if cheese_choice == "n": 65 | toppings1_input = str(input("Would you like mushrooms on your pizza? Type y for yes and n for no. ")) 66 | if toppings1_input == "y": 67 | toppings1 = "mushrooms" 68 | else: 69 | toppings1 = "no mushrooms" 70 | print("You want a " + size_choice + " pizza with " + sauce + " sauce, " + cheese + ", and " + toppings1 + ".") 71 | else: 72 | print("You want a " + size_choice + " pizza with " + sauce + " sauce, " + cheese + ", and " + toppings1 + ".") 73 | -------------------------------------------------------------------------------- /Chapter07/ch7_sleep.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | print("Let's play a game. Choose a color to learn your destiny. Choose wisely or you'll have to start over. ") 4 | 5 | 6 | i = 0 7 | while i < 4: 8 | color = str(input("Choose a color: red, green, or yellow. ")) 9 | if color == "green": 10 | print("You must wait 5 seconds to learn your fate.") 11 | time.sleep(5) 12 | print("You win! Excellent choice!") 13 | break 14 | elif color == "yellow": 15 | print("You must wait 2 seconds to learn your fate.") 16 | time.sleep(2) 17 | print("You lose! You must start over.") 18 | i = i + 1 19 | else: 20 | print("You must wait 4 seconds to learn your fate.") 21 | time.sleep(4) 22 | print("You lose! You must start over.") 23 | i = i + 1 24 | 25 | -------------------------------------------------------------------------------- /Chapter08/ch8_debugger.py: -------------------------------------------------------------------------------- 1 | number = 5 2 | number2 = 'five' 3 | 4 | print(number) 5 | 6 | breakpoint() 7 | 8 | print(number2) 9 | -------------------------------------------------------------------------------- /Chapter08/ch8_debugger2.py: -------------------------------------------------------------------------------- 1 | number = 5 2 | number2 = 'five' 3 | 4 | print(number) 5 | 6 | breakpoint() 7 | 8 | print(number + " " + number2) 9 | -------------------------------------------------------------------------------- /Chapter08/ch8_debugger3.py: -------------------------------------------------------------------------------- 1 | number = 5 2 | number2 = 'five' 3 | 4 | print(number) 5 | 6 | breakpoint() 7 | 8 | print(str(number) + " " + number2) 9 | -------------------------------------------------------------------------------- /Chapter08/ch8_errors.py: -------------------------------------------------------------------------------- 1 | print(dir(locals()['__builtins__'])) 2 | -------------------------------------------------------------------------------- /Chapter08/ch8_evenalgorithm1.py: -------------------------------------------------------------------------------- 1 | print("This program will print the even numbers for any range of numbers provided.") 2 | 3 | endpoint1 = int(input("What is the lower endpoint of your range? ")) 4 | endpoint2 = int(input("What is the upper endpoint of your range? ")) 5 | 6 | endpoint2 = endpoint2 + 1 7 | 8 | for i in range(endpoint1, endpoint2): 9 | if i % 2 == 0: 10 | print(i) 11 | 12 | 13 | -------------------------------------------------------------------------------- /Chapter08/ch8_evenalgorithm2.py: -------------------------------------------------------------------------------- 1 | print("This program will print the even numbers for any range of numbers provided.") 2 | 3 | endpoint1 = int(input("What is the lower endpoint of your range? ")) 4 | endpoint2 = int(input("What is the upper endpoint of your range? ")) 5 | 6 | endpoint2 = endpoint2 + 1 7 | 8 | evenNumbers = [] 9 | 10 | for i in range(endpoint1, endpoint2): 11 | if i % 2 == 0: 12 | evenNumbers.append(i) 13 | 14 | 15 | print(evenNumbers) 16 | -------------------------------------------------------------------------------- /Chapter08/ch8_pets1.py: -------------------------------------------------------------------------------- 1 | cat = "Whiskers" 2 | dog = "King Kong" 3 | bird = "Pirate" 4 | 5 | print("The cat's name is " + cat + ", the dog's name is " + dog + \ 6 | ", and the bird's name is " + bird + ".") 7 | 8 | -------------------------------------------------------------------------------- /Chapter08/ch8_pets2.py: -------------------------------------------------------------------------------- 1 | def myPets(cat, dog, bird): 2 | print("The cat's name is " + cat + ", the dog's name is " + dog +\ 3 | ", and the bird's name is " + bird + ".") 4 | 5 | myPets(cat = "Whiskers", dog = "King Kong", bird = "Pirate") 6 | -------------------------------------------------------------------------------- /Chapter08/ch8_pets3.py: -------------------------------------------------------------------------------- 1 | def myPets(cat, dog, bird): 2 | print("The cat's name is " + cat + ", the dog's name is " + dog +\ 3 | ", and the bird's name is " + bird + ".") 4 | 5 | myPets(cat = "Whiskers", dog = "King Kong", bird = "Pirate") 6 | myPets(cat = "Mimi", dog = "Jack", bird = "Peyo") 7 | myPets(cat = "Softy", dog = "Leila", bird = "Oliver") 8 | 9 | -------------------------------------------------------------------------------- /Chapter08/ch8_syntaxerror1.py: -------------------------------------------------------------------------------- 1 | for i in range(1, 10): 2 | print(i) 3 | -------------------------------------------------------------------------------- /Chapter08/ch8_syntaxerror2.py: -------------------------------------------------------------------------------- 1 | name = input('What is your name? ') 2 | 3 | print(name) 4 | 5 | -------------------------------------------------------------------------------- /Chapter08/ch8_syntaxerror3.py: -------------------------------------------------------------------------------- 1 | cars = { 2 | "Hyundai": "Kona", 3 | "Honda": "CR-V", 4 | "Toyota": "Camry" 5 | } 6 | print(cars) 7 | -------------------------------------------------------------------------------- /Chapter09/ch9_BookLibrary.py: -------------------------------------------------------------------------------- 1 | class Books: 2 | 3 | def __init__(self, title, author, pubDate, pages): 4 | self.title = title 5 | self.author = author 6 | self.pubDate = pubDate 7 | self.pages = pages 8 | 9 | book1 = Books('The Fundamentals of Fashion Design', 'Sorger & Udale', '2006', '176') 10 | book2 = Books('Projekt 1065: A Novel of World War II', 'Gratz', '2016', '309') 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Chapter09/ch9_Iterations.py: -------------------------------------------------------------------------------- 1 | jewelry = ['ring', 'watch', 'necklace', 'earrings', 'bracelets'] 2 | colors = ['gold', 'silver', 'blue', 'red', 'black'] 3 | 4 | for j, c in zip(jewelry, colors): 5 | print("Type of jewelry: %s in %s color. " %(j, c)) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter09/ch9_SquareLoops.py: -------------------------------------------------------------------------------- 1 | print("This program will print the squares of the numbers in a given range of numbers.") 2 | a = int(input("What is the minimum of your range? ")) 3 | b = int(input("What is the maximum of your range? ")) 4 | 5 | Numbers = [] 6 | b = b + 1 7 | for i in range(a, b): 8 | j = i**2 9 | Numbers.append(j) 10 | i = i + 1 11 | 12 | print(Numbers) 13 | -------------------------------------------------------------------------------- /Chapter09/ch9_Sums.py: -------------------------------------------------------------------------------- 1 | a = int(input("Provide the first number to be added. ")) 2 | b = int(input("Please provide the second number to be added. ")) 3 | c = int(input("Provide the last number to be added. ")) 4 | 5 | print(eval('a + b + c')) 6 | 7 | -------------------------------------------------------------------------------- /Chapter09/ch9_Sums2.py: -------------------------------------------------------------------------------- 1 | a = int(input("Provide the first number to be added. ")) 2 | b = int(input("Please provide the second number to be added. ")) 3 | c = int(input("Provide the last number to be added. ")) 4 | 5 | numbers = [] 6 | numbers.append(a) 7 | numbers.append(b) 8 | numbers.append(c) 9 | 10 | print(sum(numbers)) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter09/ch9_absFunction.py: -------------------------------------------------------------------------------- 1 | x = abs(-3.89) 2 | print(x) 3 | -------------------------------------------------------------------------------- /Chapter09/ch9_addressBook.py: -------------------------------------------------------------------------------- 1 | class Entry: 2 | 3 | def __init__(self, firstName, lastName, phone): 4 | self.firstName = firstName 5 | self.lastName = lastName 6 | self.phone = phone 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Chapter09/ch9_colorLoop.py: -------------------------------------------------------------------------------- 1 | colors = ['blue', 'green', 'red'] 2 | for color in colors: 3 | print(color) 4 | 5 | -------------------------------------------------------------------------------- /Chapter09/ch9_dictionary1.py: -------------------------------------------------------------------------------- 1 | states = { 2 | 'Ohio':'Columbus', 3 | 'Delaware':'Dover', 4 | 'Pennsylvania':'Harrisburg', 5 | 'Vermont':'Montpelier' 6 | } 7 | 8 | print(states) 9 | -------------------------------------------------------------------------------- /Chapter09/ch9_dictionary2.py: -------------------------------------------------------------------------------- 1 | states = dict([ 2 | ('Ohio','Columbus'), 3 | ('Delaware','Dover'), 4 | ('Pennsylvania','Harrisburg'), 5 | ('Vermont','Montpelier') 6 | ]) 7 | 8 | 9 | print(states) 10 | -------------------------------------------------------------------------------- /Chapter09/ch9_dictionary3.py: -------------------------------------------------------------------------------- 1 | miscellaneous = { 2 | 'sports' : ['tennis', 'bowling', 'golf'], 3 | 'age' : '40', 4 | 'home' : 'lake' 5 | } 6 | 7 | -------------------------------------------------------------------------------- /Chapter09/ch9_evenNumbers.py: -------------------------------------------------------------------------------- 1 | def evenNumbers(i, j): 2 | a = i - 1 3 | b = j + 1 4 | for number in range(a, b): 5 | if number % 2 == 0: 6 | print(number) 7 | a = a + 1 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Chapter09/ch9_evenNumbers2.py: -------------------------------------------------------------------------------- 1 | listEvens = [] 2 | def evenNumbers(i, j): 3 | a = i - 1 4 | b = j + 1 5 | for number in range(a, b): 6 | if number % 2 == 0: 7 | listEvens.append(number) 8 | a = a + 1 9 | print(listEvens) 10 | 11 | 12 | -------------------------------------------------------------------------------- /Chapter09/ch9_files1.py: -------------------------------------------------------------------------------- 1 | file = open("/Users/smargarita99/Documents/Python/ch8_textfile") 2 | -------------------------------------------------------------------------------- /Chapter09/ch9_list1.py: -------------------------------------------------------------------------------- 1 | fruits = ['apple','apple','apple'] 2 | print(fruits) 3 | -------------------------------------------------------------------------------- /Chapter09/ch9_list2.py: -------------------------------------------------------------------------------- 1 | animals = ['dog', 'cat', 'bird', 'lion', 'tiger', 'elephant'] 2 | 3 | print(animals) 4 | -------------------------------------------------------------------------------- /Chapter09/ch9_list3.py: -------------------------------------------------------------------------------- 1 | animals = ['dog', 'cat', 'bird', 'lion', 'tiger', 'elephant'] 2 | colors = ['blue', 'red', 'yellow'] 3 | 4 | print(animals) 5 | print(colors) 6 | 7 | -------------------------------------------------------------------------------- /Chapter09/ch9_list4.py: -------------------------------------------------------------------------------- 1 | animals = ['dog', 'cat', 'bird', 'lion', 'tiger', 'elephant'] 2 | numbers = [4, 1, 5, 8, 2, 4] 3 | 4 | print(animals) 5 | print(numbers) 6 | 7 | -------------------------------------------------------------------------------- /Chapter09/ch9_mammals.py: -------------------------------------------------------------------------------- 1 | class mammals: 2 | def description(self): 3 | print("Mammals are vertebrate animals.") 4 | 5 | def viviparous(self): 6 | print("Mammals are viviparous, but some are not.") 7 | 8 | class monkey(mammals): 9 | def viviparous(self): 10 | print("Monkeys are viviparous.") 11 | 12 | class platypus(mammals): 13 | def viviparous(self): 14 | print("The platypus is not viviparous. It's an egg-laying mammal.") 15 | 16 | obj_mammals = mammals() 17 | obj_monkey = monkey() 18 | obj_platypus = platypus() 19 | 20 | obj_mammals.description() 21 | obj_mammals.viviparous() 22 | 23 | obj_monkey.description() 24 | obj_monkey.viviparous() 25 | 26 | obj_platypus.description() 27 | obj_platypus.viviparous() 28 | -------------------------------------------------------------------------------- /Chapter09/ch9_nameFunction.py: -------------------------------------------------------------------------------- 1 | def nameFunction(name): 2 | print('Hello ' + name) 3 | 4 | -------------------------------------------------------------------------------- /Chapter09/ch9_reverse.py: -------------------------------------------------------------------------------- 1 | myList = [1, 3, 5] 2 | 3 | print(reversed(myList)) 4 | 5 | -------------------------------------------------------------------------------- /Chapter09/ch9_survey.txt: -------------------------------------------------------------------------------- 1 | Payton - Blue 2 | Johnny - Red 3 | Maxi - Blue 4 | Jacky - Red 5 | Alicia - Blue 6 | Jackson - Yellow 7 | Percy - Yellow -------------------------------------------------------------------------------- /Chapter09/ch9_surveyData.py: -------------------------------------------------------------------------------- 1 | with open("ch8_survey.txt") as file: 2 | for line in file: 3 | line = line.strip() 4 | divide = line.split(" - ") 5 | name = divide[0] 6 | color = divide[1] 7 | print(name + " voted for " + color) 8 | 9 | -------------------------------------------------------------------------------- /Chapter09/ch9_surveyData2.py: -------------------------------------------------------------------------------- 1 | print("The votes for Blue are in.") 2 | blues = 0 3 | with open("ch8_survey.txt") as file: 4 | for line in file: 5 | line = line.strip() 6 | name, color = line.split(' - ') 7 | if color == "Blue": 8 | blues = blues + 1 9 | print(blues) 10 | 11 | 12 | -------------------------------------------------------------------------------- /Chapter09/ch9_variables.py: -------------------------------------------------------------------------------- 1 | name = 'Marcus' 2 | b = 10 3 | country_1 = 'Greece' 4 | 5 | print(name) 6 | print(b) 7 | print(country_1) 8 | -------------------------------------------------------------------------------- /Chapter09/ch9_variables2.py: -------------------------------------------------------------------------------- 1 | a, b, c, d = 'John', 'Mike', 'Jayden', 'George' 2 | print(a) 3 | print(b) 4 | print(c) 5 | print(d) 6 | -------------------------------------------------------------------------------- /Chapter09/ch9_whileLoop.py: -------------------------------------------------------------------------------- 1 | ask = int(input("Please type a number less than 20. ")) 2 | while ask > 0: 3 | print(ask * 2) 4 | ask = ask - 1 5 | 6 | -------------------------------------------------------------------------------- /Chapter10/ch10_input1.py: -------------------------------------------------------------------------------- 1 | name = input("What is your name? ") 2 | print("Nice to meet you " + name + ".") 3 | -------------------------------------------------------------------------------- /Chapter10/ch10_input2.py: -------------------------------------------------------------------------------- 1 | name = input() 2 | print("Nice to meet you " + name + ".") 3 | -------------------------------------------------------------------------------- /Chapter10/ch10_input3.py: -------------------------------------------------------------------------------- 1 | #Create the list 2 | names = [] 3 | 4 | #Ask user how many names will be added 5 | name = int(input("How many names will be in the list? ")) 6 | 7 | #Iterate to add each name to the list 8 | for i in range(0, name): 9 | people = str(input()) 10 | 11 | names.append(people) 12 | 13 | print(names) 14 | -------------------------------------------------------------------------------- /Chapter10/ch10_input4.py: -------------------------------------------------------------------------------- 1 | #Create the list 2 | names = [] 3 | 4 | #Ask user how many names will be added 5 | name = int(input("How many names will be in the list? ")) 6 | 7 | #Iterate to add each name to the list 8 | for i in range(0, name): 9 | people = input("Type the next name on the list. ") 10 | 11 | names.append(people) 12 | 13 | print(names) 14 | -------------------------------------------------------------------------------- /Chapter10/ch10_input5.py: -------------------------------------------------------------------------------- 1 | name1, name2 = input("Enter First Name: "), input("Enter Last Name: ") 2 | 3 | print(name1 + " " + name2) 4 | -------------------------------------------------------------------------------- /Chapter10/ch10_problem1.py: -------------------------------------------------------------------------------- 1 | #Print initial message for the user 2 | print("This program will take your message and encode it.") 3 | 4 | #Ask for the message 5 | msg = input("What message would you like to code? ") 6 | 7 | #Ask for shift 8 | shift = int(input("How many places will you shift your message? ")) 9 | msgCipher = "" 10 | 11 | #Iterate through the letters, adjusting for shift 12 | for letter in msg: 13 | k = ord(letter) 14 | if 48 <= k <= 57: 15 | newk = (k - 48 + shift)%10 + 48 16 | elif 65 <= k <= 90: 17 | newk = (k - 65 + shift)%26 + 65 18 | elif 97 <= k <=122: 19 | newk = (k - 97 + shift)%26 + 97 20 | else: 21 | newk = k 22 | msgCipher += chr(newk) 23 | print("Your coded message is below.") 24 | print(msgCipher) 25 | -------------------------------------------------------------------------------- /Chapter10/ch10_problem2.py: -------------------------------------------------------------------------------- 1 | #Define the list name 2 | maxList = [] 3 | #Ask user how many numbers will be entered 4 | quant = int(input("How many data points are you entering? ")) 5 | #Iterate, append points, and find maximum 6 | for i in range(0, quant): 7 | dataPoint = int(input("Enter number: ")) 8 | maxList.append(dataPoint) 9 | #Print maximum value 10 | print("The maximum value is " + str(max(maxList)) + ".") 11 | 12 | -------------------------------------------------------------------------------- /Chapter10/ch10_problem3.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | 3 | number = rand.randint(1000,10000) 4 | 5 | guess = int(input("What's your first guess? ")) 6 | 7 | #Algorithm checks if number is correct. 8 | if (guess == number): 9 | print("That's right! You win!") 10 | else: 11 | i = 0 12 | #Condition so that user keeps guessing until they win. 13 | while (guess != number): 14 | i = i + 1 15 | #Remember you can also write as i += 1 16 | j = 0 17 | guess = str(guess) 18 | number = str(number) 19 | 20 | #Check which numbers are correct and mark incorrect with 'N' 21 | guessY = ['N']*4 22 | 23 | #Make sure you check each digit, so run loop 4 times 24 | for q in range(0, 4): 25 | if (guess[q] == number[q]): 26 | j += 1 27 | guessY[q] = guess[q] 28 | else: 29 | continue 30 | 31 | #If only some digits are correct, run next condition 32 | if (j < 4) and (j != 0): 33 | print("You have " + str(j) + " digit(s) right.") 34 | print("These numbers were correct.") 35 | for m in guessY: 36 | print(m, end = " ") 37 | 38 | #Ask for next input 39 | guess = int(input("What is your next guess? ")) 40 | 41 | #No digits correct 42 | elif (j == 0): 43 | print("None of these digits are correct.") 44 | guess = int(input("What is your next guess? ")) 45 | 46 | if guess == number: 47 | print("It took you " + str(i)+ " tries to win!") 48 | -------------------------------------------------------------------------------- /Chapter11/ch11_forLoop1.py: -------------------------------------------------------------------------------- 1 | for letter in 'mountain': 2 | print(letter) 3 | -------------------------------------------------------------------------------- /Chapter11/ch11_forLoop2.py: -------------------------------------------------------------------------------- 1 | for num in range(1, 11): 2 | print(num) 3 | -------------------------------------------------------------------------------- /Chapter11/ch11_forLoop3.py: -------------------------------------------------------------------------------- 1 | myNumbers = [] 2 | for num in range(1, 11): 3 | myNumbers.append(num) 4 | print(myNumbers) 5 | -------------------------------------------------------------------------------- /Chapter11/ch11_forLoop4.py: -------------------------------------------------------------------------------- 1 | print('This program will provide a list of cubes for you. ') 2 | minRange = int(input('What\'s the minimum for your range? ')) 3 | maxRange = int(input('What\'s the maximum for your range? ')) 4 | listOfCubes = [] 5 | 6 | for value in range(minRange, maxRange+1): 7 | number = value**3 8 | listOfCubes.append(number) 9 | 10 | print('Your list of cubes in the range(' + str(minRange) + ', ' \ 11 | +str(maxRange) + ') is: ') 12 | print(listOfCubes) 13 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions1.py: -------------------------------------------------------------------------------- 1 | minNum = int(input('What\'s your minimum number? ')) 2 | maxNum = int(input('What\'s your maximum number? ')) 3 | 4 | 5 | def myNumbers(minNum, maxNum): 6 | myList = [] 7 | for num in range(minNum, maxNum + 1): 8 | myList.append(num) 9 | print(myList) 10 | 11 | 12 | myNumbers(minNum, maxNum) 13 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions2.py: -------------------------------------------------------------------------------- 1 | def myNumbers(minNum, maxNum): 2 | myList = [] 3 | for num in range(minNum, maxNum + 1): 4 | myList.append(num) 5 | print(myList) 6 | 7 | 8 | myNumbers(4, 9) 9 | myNumbers(1, 3) 10 | myNumbers(9, 17) 11 | 12 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions3.py: -------------------------------------------------------------------------------- 1 | def menu(appetizer, entree, dessert): 2 | print('Your appetizer is %s.' %(appetizer)) 3 | print('You entree is %s.' %(entree)) 4 | print('Your dessert is %s.' %(dessert)) 5 | 6 | menu('street tacos', 'chilaquiles', 'sopapillas') 7 | 8 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions4.py: -------------------------------------------------------------------------------- 1 | appetizer = input('What would you like as an appetizer? ') 2 | entree = input('What would you like as an entree? ') 3 | dessert = input('what would you like for dessert? ') 4 | 5 | 6 | def menu(appetizer, entree, dessert): 7 | print('Your appetizer is %s.' %(appetizer)) 8 | print('You entree is %s.' %(entree)) 9 | print('Your dessert is %s.' %(dessert)) 10 | 11 | menu(appetizer, entree, dessert) 12 | 13 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions5.py: -------------------------------------------------------------------------------- 1 | numItem = int(input('What is your maximum number for the list of triples? ')) 2 | def cost(numItem): 3 | while numItem > 0: 4 | print(numItem * 3) 5 | numItem -= 1 6 | 7 | 8 | cost(numItem) 9 | -------------------------------------------------------------------------------- /Chapter11/ch11_functions6.py: -------------------------------------------------------------------------------- 1 | numItem = int(input('What is your maximum number for the list of triples? ')) 2 | myList = [] 3 | def cost(numItem): 4 | for x in range(1, numItem + 1): 5 | newNum = 3 * x 6 | myList.append(newNum) 7 | print(myList) 8 | 9 | 10 | cost(numItem) 11 | -------------------------------------------------------------------------------- /Chapter11/ch11_rollDice.py: -------------------------------------------------------------------------------- 1 | import random as rand 2 | print("Let's play a game. ") 3 | print("You get 5 points for rolling 1 or 3. You get 5 points for rolling 2, 4, or 6.") 4 | print("You lose all points if you roll a 5 in either round.") 5 | ready = input("Are you ready to begin? Type r to roll. ") 6 | score = 0 7 | 8 | if ready == 'r': 9 | roll = rand.randint(1, 6) 10 | print('You rolled a ' + str(roll) + '.') 11 | 12 | if (roll == 1) or (roll == 3): 13 | score = 5 14 | elif (roll == 5): 15 | score = 0 16 | else: 17 | score = 10 18 | ready2 = input('Your round 1 score is ' + str(score) + '. Type r to roll again. ') 19 | roll2 = rand.randint(1, 6) 20 | print('You rolled a ' + str(roll2) + '.') 21 | if (roll2 == 1) or (roll2 == 3): 22 | score += 5 23 | elif (roll2 == 5): 24 | score = 0 25 | else: 26 | score += 10 27 | print('Your final score is ' + str(score) + '.') 28 | 29 | -------------------------------------------------------------------------------- /Chapter11/ch11_whileLoop1.py: -------------------------------------------------------------------------------- 1 | myAnimals = [] 2 | print('Let\'s see how many animals you can name. Get ready!') 3 | readyPlayer = input('When you are ready to begin, type y. ') 4 | while readyPlayer == 'y': 5 | animalAdd = input('Name an animal. ') 6 | myAnimals.append(animalAdd) 7 | readyPlayer = input('Ready for the next one? Type y for yes or n for no. ') 8 | howMany = len(myAnimals) 9 | print(f'You were able to name {howMany} animals. Here\'s your list: ') 10 | print(myAnimals) -------------------------------------------------------------------------------- /Chapter11/ch11_whileLoop2.py: -------------------------------------------------------------------------------- 1 | while True: 2 | num = int(input('Please enter an integer 0 through 9. ')) 3 | if num in range(0, 10): 4 | print(num) 5 | else: 6 | print('That\'s not in range. ') 7 | break 8 | -------------------------------------------------------------------------------- /Chapter11/ch11_whileLoop3.py: -------------------------------------------------------------------------------- 1 | while True: 2 | num = int(input('Please enter an integer 0 through 9. Tired? Type a number out of range. ')) 3 | if num in range(0, 10): 4 | print(num) 5 | else: 6 | print('That\'s not in range. ') 7 | break 8 | -------------------------------------------------------------------------------- /Chapter12/ch12_pledgesA.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | tier1 = 1600 4 | tier2 = 800 5 | tier3 = 700 6 | 7 | perc = int(input("What percentage of the 100,000 do you expect will be Tier 1? Type a number between 1 and 100. ")) 8 | percentage = perc/100 9 | 10 | Tier1 = (100000*percentage)/1600 11 | totalTier1 = math.ceil(Tier1) 12 | 13 | print("You will need to sell %s Tier 1 pledges if you want %s percent of your sales to be in Tier 1." % (totalTier1,perc)) 14 | -------------------------------------------------------------------------------- /Chapter12/ch12_pledgesB.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | tier1 = 1600 4 | tier2 = 800 5 | tier3 = 700 6 | 7 | perc = int(input("What percentage of the 100,000 do you expect will be Tier 1? Type a number between 1 and 100. ")) 8 | percentage = perc/100 9 | 10 | Tier1 = (100000*percentage)/1600 11 | totalTier1 = math.ceil(Tier1) 12 | 13 | print("You will need to sell %s Tier 1 pledges if you want %s percent of your sales to be in Tier 1." % (totalTier1,perc)) 14 | print("You will need %s items, %s accessories kits, %s carrying cases, and %s year-long memberships." %(totalTier1*2, totalTier1, totalTier1, totalTier1)) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Chapter12/ch12_pledgesC.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | tier1 = 1600 4 | tier2 = 800 5 | tier3 = 700 6 | 7 | perc = int(input("What percentage of the 100,000 do you expect will be Tier 1? Type a number between 1 and 100. ")) 8 | 9 | percTier1 = perc/100 10 | percTier2 = (100-perc)/3/100 11 | percTier3 = (100-perc-percTier2)/100 12 | 13 | Tier1 = (100000*percTier1)/1600 14 | totalTier1 = math.ceil(Tier1) 15 | itemsTier1 = totalTier1*2 16 | accTier1 = totalTier1 17 | cases1 = totalTier1 18 | yearMemb = totalTier1 19 | 20 | Tier2 = (100000*percTier2)/800 21 | totalTier2 = math.ceil(Tier2) 22 | itemsTier2 = totalTier2 23 | cases2 = totalTier2 24 | sixMemb = totalTier2 25 | 26 | Tier3 = (100000*percTier3)/700 27 | totalTier3 = math.ceil(Tier3) 28 | itemsTier3 = totalTier3 29 | cases3 = totalTier3 30 | 31 | totalItems = itemsTier1 + itemsTier2 + itemsTier3 32 | totalAccessories = accTier1 33 | totalCases = cases1 + cases2 + cases3 34 | 35 | print("You will need to sell %s Tier 1 pledges if you want %s percent of your sales to be in Tier 1." %(totalTier1, perc)) 36 | print("You will need %s Tier 2 pledges and %s Tier 3 pledges to meet or exceed your $100,000 funding goal." % (totalTier2, totalTier3)) 37 | print("These percentages are equivalent to %s total items, %s total cases, %s accessories kits, %s year-long memberships, and %s six-month memberships." \ 38 | % (totalItems, totalCases, totalAccessories, yearMemb, sixMemb)) 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Chapter12/ch12_pledgesTemplate.py: -------------------------------------------------------------------------------- 1 | import math 2 | numberTiers = int(input("How many tiers of pledges will you offer? Enter a number between 3 and 5 inclusive. ")) 3 | 4 | #Number of tiers percentages 5 | if numberTiers == 3: 6 | tier1 = .50 7 | tier2 = .30 8 | tier3 = .20 9 | elif numberTiers == 4: 10 | tier1 = .40 11 | tier2 = .30 12 | tier3 = .20 13 | tier4 = .10 14 | elif numberTiers == 5: 15 | tier1 = .40 16 | tier2 = .30 17 | tier3 = .15 18 | tier4 = .10 19 | tier5 = .05 20 | else: 21 | print("Please try again and enter the numbers 3, 4, or 5. ") 22 | 23 | #Number of items per tier 24 | if numberTiers == 3: 25 | numTier1Items = int(input("How many items will be provided for a Tier 1 pledge? ")) 26 | numTier2Items = int(input("How many items will be provided for a Tier 2 pledge? ")) 27 | numTier3Items = int(input("How many items will be provided for a Tier 3 pledge? ")) 28 | elif numberTiers == 4: 29 | numTier1Items = int(input("How many items will be provided for a Tier 1 pledge? ")) 30 | numTier2Items = int(input("How many items will be provided for a Tier 2 pledge? ")) 31 | numTier3Items = int(input("How many items will be provided for a Tier 3 pledge? ")) 32 | numTier4Items = int(input("How many items will be provided for a Tier 4 pledge? ")) 33 | elif numberTiers == 5: 34 | numTier1Items = int(input("How many items will be provided for a Tier 1 pledge? ")) 35 | numTier2Items = int(input("How many items will be provided for a Tier 2 pledge? ")) 36 | numTier3Items = int(input("How many items will be provided for a Tier 3 pledge? ")) 37 | numTier4Items = int(input("How many items will be provided for a Tier 4 pledge? ")) 38 | numTier5Items = int(input("How many items will be provided for a Tier 5 pledge? ")) 39 | 40 | #Price points for each Tier 41 | if numberTiers == 3: 42 | priceTier1 = int(input("What is the price point of Tier 1? Enter dollar amount without dollar sign. ")) 43 | priceTier2 = int(input("What is the price point of Tier 2? Enter dollar amount without dollar sign. ")) 44 | priceTier3 = int(input("What is the price point of Tier 3? Enter dollar amount without dollar sign. ")) 45 | elif numberTiers == 4: 46 | priceTier1 = int(input("What is the price point of Tier 1? Enter dollar amount without dollar sign. ")) 47 | priceTier2 = int(input("What is the price point of Tier 2? Enter dollar amount without dollar sign. ")) 48 | priceTier3 = int(input("What is the price point of Tier 3? Enter dollar amount without dollar sign. ")) 49 | priceTier4 = int(input("What is the price point of Tier 4? Enter dollar amount without dollar sign. ")) 50 | elif numberTiers == 5: 51 | priceTier1 = int(input("What is the price point of Tier 1? Enter dollar amount without dollar sign. ")) 52 | priceTier2 = int(input("What is the price point of Tier 2? Enter dollar amount without dollar sign. ")) 53 | priceTier3 = int(input("What is the price point of Tier 3? Enter dollar amount without dollar sign. ")) 54 | priceTier4 = int(input("What is the price point of Tier 4? Enter dollar amount without dollar sign. ")) 55 | priceTier5 = int(input("What is the price point of Tier 5? Enter dollar amount without dollar sign. ")) 56 | 57 | #Breakdown of number of Tiers based on funding goal 58 | fundGoal = int(input("What is the funding goal for this campaign? Enter dollar amount with no symbols. ")) 59 | 60 | if numberTiers == 3: 61 | Tier1Total = math.ceil(fundGoal*tier1/priceTier1) 62 | Tier2Total = math.ceil(fundGoal*tier2/priceTier2) 63 | Tier3Total = math.ceil(fundGoal*tier3/priceTier3) 64 | print("For a funding goal of %s with %s tiers, you'll need %s Tier 1 pledges, %s Tier 2 pledges, and %s Tier 3 pledges. " % (fundGoal, numberTiers, Tier1Total, Tier2Total, Tier3Total)) 65 | Tier1Items = numTier1Items*Tier1Total 66 | Tier2Items = numTier2Items*Tier2Total 67 | Tier3Items = numTier3Items*Tier3Total 68 | print("For %s Tier 1 pledges, you'll need %s items. For %s Tier 2 pledges, you'll need %s items. For %s Tier 3 pledges, you'll need %s items. " %(Tier1Total, Tier1Items, Tier2Total, Tier2Items, Tier3Total, Tier3Items)) 69 | elif numberTiers == 4: 70 | Tier1Total = math.ceil(fundGoal*tier1/priceTier1) 71 | Tier2Total = math.ceil(fundGoal*tier2/priceTier2) 72 | Tier3Total = math.ceil(fundGoal*tier3/priceTier3) 73 | Tier4Total = math.ceil(fundGoal*tier4/priceTier4) 74 | print("For a funding goal of %s with %s tiers, you'll need %s Tier 1 pledges, %s Tier 2 pledges, %s Tier 3 pledges, and %s Tier 4 pledges. " % (fundGoal, numberTiers, Tier1Total, Tier2Total, Tier3Total, Tier4Total)) 75 | Tier1Items = numTier1Items*Tier1Total 76 | Tier2Items = numTier2Items*Tier2Total 77 | Tier3Items = numTier3Items*Tier3Total 78 | Tier4Items = numTier4Items*Tier4Total 79 | print("For %s Tier 1 pledges, you'll need %s items. For %s Tier 2 pledges, you'll need %s items. For %s Tier 3 pledges, you'll need %s items. For %s Tier 4 pledges, you'll need %s items. " %(Tier1Total, Tier1Items, Tier2Total, Tier2Items, Tier3Total, Tier3Items, Tier4Total, Tier4Items)) 80 | elif numberTiers == 5: 81 | Tier1Total = math.ceil(fundGoal*tier1/priceTier1) 82 | Tier2Total = math.ceil(fundGoal*tier2/priceTier2) 83 | Tier3Total = math.ceil(fundGoal*tier3/priceTier3) 84 | Tier4Total = math.ceil(fundGoal*tier4/priceTier4) 85 | Tier5Total = math.ceil(fundGoal*tier5/priceTier5) 86 | print("For a funding goal of %s with %s tiers, you'll need %s Tier 1 pledges, %s Tier 2 pledges, %s Tier 3 pledges, %s Tier 4 pledges, and %s Tier 5 pledges. " % (fundGoal, numberTiers, Tier1Total, Tier2Total, Tier3Total, Tier4Total, Tier5Total)) 87 | Tier1Items = numTier1Items*Tier1Total 88 | Tier2Items = numTier2Items*Tier2Total 89 | Tier3Items = numTier3Items*Tier3Total 90 | Tier4Items = numTier4Items*Tier4Total 91 | Tier5Items = numTier5Items*Tier5Total 92 | print("For %s Tier 1 pledges, you'll need %s items. For %s Tier 2 pledges, you'll need %s items. For %s Tier 3 pledges, you'll need %s items. For %s Tier 4 pledges, you'll need %s items. For %s Tier 5 pledges, you'll need %s items. " %(Tier1Total, Tier1Items, Tier2Total, Tier2Items, Tier3Total, Tier3Items, Tier4Total, Tier4Items, Tier5Total, Tier5Items)) 93 | 94 | -------------------------------------------------------------------------------- /Chapter13/ch13_global.py: -------------------------------------------------------------------------------- 1 | counter = 1 2 | 3 | def counterF(): 4 | print(f'Counter value is {counter}.') 5 | 6 | counterF() 7 | -------------------------------------------------------------------------------- /Chapter13/ch13_local.py: -------------------------------------------------------------------------------- 1 | def counterF(): 2 | counter = 1 3 | print(f'Counter value is {counter}.') 4 | 5 | counterF() 6 | -------------------------------------------------------------------------------- /Chapter13/ch13_sample1.py: -------------------------------------------------------------------------------- 1 | pastaAlfredo = 15.75 2 | menu = { 3 | pastaAlfredo 4 | } 5 | def priceIncrease(percentage): 6 | for item in menu: 7 | item = item + item * (percentage/100) 8 | print(round(item,2)) 9 | priceIncrease(30) 10 | -------------------------------------------------------------------------------- /Chapter13/ch13_sample2.py: -------------------------------------------------------------------------------- 1 | pastaAlfredo = 15.75 2 | 3 | menu = { 4 | pastaAlfredo 5 | } 6 | 7 | def priceIncrease(percentage): 8 | for item in menu: 9 | item = item + item * (percentage/100) 10 | print(round(item,2)) 11 | def deliveryPrice(): 12 | for item in menu: 13 | print(f'Menu item price is ${item}.') 14 | priceIncrease(30) 15 | deliveryPrice() 16 | 17 | -------------------------------------------------------------------------------- /Chapter14/ch14_abbreviate.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | myArray = np.arange(0, 12).reshape(2, 6) 4 | 5 | print(myArray) 6 | -------------------------------------------------------------------------------- /Chapter14/ch14_csvAnalysis.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib as mlp 3 | import matplotlib.pyplot as plt 4 | import os 5 | 6 | #Let Python know correct directory for file. 7 | os.chdir('C:\\...') 8 | print('Current directory', os.getcwd()) 9 | 10 | -------------------------------------------------------------------------------- /Chapter14/ch14_csvAnalysis_2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib as mlp 3 | import matplotlib.pyplot as plt 4 | import os 5 | 6 | #Let Python know correct directory for file. 7 | os.chdir('C:\\...') 8 | 9 | graduates = pd.read_csv('ch12_data.csv', index_col = 0) 10 | print(graduates[0:16]) 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Chapter14/ch14_csvAnalysis_3.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib as mlp 3 | import matplotlib.pyplot as plt 4 | import os 5 | 6 | #Let Python know correct directory for file. 7 | os.chdir('C:\\...') 8 | 9 | graduates = pd.read_csv('ch12_data.csv', index_col = 0) 10 | print(graduates[0:13]) 11 | 12 | fig, ax = plt.subplots() 13 | ax.bar(graduates.index, graduates['Hispanic']) 14 | ax.set_xticks(graduates.index) 15 | ax.set_xticklabels(graduates.index, rotation = 60, horizontalalignment = 'right') 16 | ax.set_title('Number of Hispanic graduates from 1996-2012', fontsize = 16) 17 | ax.set_ylabel('Number of Graduates') 18 | 19 | plt.show() 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Chapter14/ch14_data.csv: -------------------------------------------------------------------------------- 1 | 4-year Institutions - Years,Total,White,Black,Hispanic,Total Asias/Pacific Islanders,Asian,Pacific Islander,American Indian/ Alaska Native,Two or more races,Non-resident alien\1\ 2 | 1996,33.7,36.3,19.5,22.8,37.5,---,---,18.8,---,41.7 3 | 2000,36.1,38.9,21.2,25.8,40.9,---,---,21.0,---,41.9 4 | 2002,36.6,39.6,20.5,26.6,43.0,---,---,20.6,---,39.1 5 | 2003,37.0,40.2,20.2,26.7,43.9,---,---,20.6,---,39.4 6 | 2004,38.0,41.3,20.5,27.9,45.0,---,---,21.8,---,43.7 7 | 2005,38.3,41.8,20.2,28.2,45.1,45.5,22.2,21.8,44.1,44.0 8 | 2006,39.1,42.7,20.6,29.3,46.0,46.4,24.2,21.9,46.6,44.1 9 | 2007,39.4,43.3,20.8,29.8,46.2,46.7,25.9,23.0,49.1,44.6 10 | 2008,39.8,43.7,21.4,30.4,47.1,47.7,26.7,23.0,46.5,46.4 11 | 2009,39.9,44.2,20.6,30.7,48.8,49.5,26.7,24.0,41.0,49.1 12 | 2010,40.7,45.4,21.2,31.7,49.6,50.2,31.0,22.7,39.6,50.1 13 | 2011,41.6,46.4,21.6,32.5,50.1,50.7,31.0,21.6,38.3,50.8 14 | 2012,43.7,48.3,23.8,34.1,52.0,52.6,31.7,24.4,39.3,51.9 15 | -------------------------------------------------------------------------------- /Chapter14/ch14_matplotlib.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | 3 | plt.plot([0, 3, 6], [4, 5, 6]) 4 | plt.show() 5 | -------------------------------------------------------------------------------- /Chapter14/ch14_pairplotSNS.py: -------------------------------------------------------------------------------- 1 | # Import seaborn 2 | import seaborn as sns 3 | 4 | sns.set_style('darkgrid') 5 | # Load an example dataset 6 | flights = sns.load_dataset("flights") 7 | 8 | #Create the plot 9 | sns.pairplot( 10 | data=flights, 11 | ) 12 | -------------------------------------------------------------------------------- /Chapter14/ch14_pdDataFrame.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | myAddressBook = {'names': ['Susan', 'Malena', 'Isabel', 'Juan', 'Mike'], 4 | 'phoneNumbers':['333-333-3333', '444-444-4444', '555-555-5555', 5 | '777-777-7777', '888-888-8888']} 6 | addressBook = pd.DataFrame(myAddressBook) 7 | print(addressBook) 8 | -------------------------------------------------------------------------------- /Chapter14/ch14_seabornSample.py: -------------------------------------------------------------------------------- 1 | # Import seaborn 2 | import seaborn as sns 3 | 4 | sns.set_style('darkgrid') 5 | # Load an example dataset 6 | exercise = sns.load_dataset("exercise") 7 | 8 | #Create the plot 9 | sns.relplot( 10 | data=exercise, 11 | x='id', y="pulse", col="time", 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /Chapter15/ch15_BIRCH.py: -------------------------------------------------------------------------------- 1 | from numpy import unique 2 | from numpy import where 3 | from sklearn.datasets import make_classification 4 | from sklearn.cluster import Birch 5 | from matplotlib import pyplot 6 | #Synthetic dataset definition 7 | X, _ = make_classification(n_samples=1800, n_features=2, n_informative=2, n_redundant=0, n_clusters_per_class=1, random_state=4) 8 | #Define the BIRCH model 9 | model = Birch(threshold=0.01, n_clusters=2) 10 | model.fit(X) 11 | yhat = model.predict(X) 12 | #Clusters 13 | clusters = unique(yhat) 14 | #Display 15 | for cluster in clusters: 16 | row_ix = where(yhat == cluster) 17 | pyplot.scatter(X[row_ix, 0], X[row_ix, 1]) 18 | pyplot.show() 19 | -------------------------------------------------------------------------------- /Chapter15/ch15_KMeans.py: -------------------------------------------------------------------------------- 1 | from numpy import unique 2 | from numpy import where 3 | from sklearn.datasets import make_classification 4 | from sklearn.cluster import KMeans 5 | from matplotlib import pyplot 6 | 7 | #Dataset definition 8 | X, _ = make_classification(n_samples = 1800, n_features = 2, n_informative = 2, n_redundant = 0, n_clusters_per_class = 1, random_state = 4) 9 | #Model identification and fit 10 | model = KMeans(n_clusters = 2) 11 | model.fit(X) 12 | #Clusters 13 | yhat = model.predict(X) 14 | clusters = unique(yhat) 15 | #Display 16 | for cluster in clusters: 17 | row_ix = where(yhat == cluster) 18 | pyplot.scatter(X[row_ix, 0], X[row_ix, 1]) 19 | pyplot.show() 20 | -------------------------------------------------------------------------------- /Chapter15/ch15_diabetesA.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | import numpy as np 4 | 5 | dataset = pd.read_csv('diabetes.csv') 6 | 7 | # Split dataset into input(x) and output(y) variables 8 | x_variables = dataset.iloc[:,0:8] 9 | y_variable = dataset.iloc[:,8] 10 | 11 | print(x_variables) 12 | print(y_variable) 13 | 14 | from sklearn.model_selection import train_test_split 15 | X_train,X_test, y_train,y_test = train_test_split(x_variables, y_variable, test_size = 0.20, random_state = 10) 16 | -------------------------------------------------------------------------------- /Chapter15/ch15_diabetesB.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | import numpy as np 4 | 5 | dataset = pd.read_csv('diabetes.csv') 6 | 7 | # Split dataset into input(x) and output(y) variables 8 | x_variables = dataset.iloc[:,0:8] 9 | y_variable = dataset.iloc[:,8] 10 | 11 | print(x_variables) 12 | print(y_variable) 13 | 14 | 15 | from sklearn.model_selection import train_test_split 16 | from keras import Sequential 17 | from keras.layers import Dense 18 | #Defining the Model 19 | model = Sequential() 20 | model.add(Dense(12, input_dim=8, activation='relu')) 21 | model.add(Dense(15, activation='relu')) 22 | model.add(Dense(8, activation='relu')) 23 | model.add(Dense(1, activation='sigmoid')) 24 | 25 | 26 | #Compile the model 27 | model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) 28 | #Fit the model on the dataset 29 | model.fit(x_variables, y_variable, epochs=95, batch_size=25) 30 | #Evaluate the model 31 | _, accuracy = model.evaluate(x_variables, y_variable) 32 | print('Accuracy: %.2f' % (accuracy*100)) 33 | model.summary() 34 | -------------------------------------------------------------------------------- /Chapter15/ch15_syntheticDataset.py: -------------------------------------------------------------------------------- 1 | from numpy import where 2 | from sklearn.datasets import make_classification 3 | from matplotlib import pyplot 4 | 5 | #Create a synthetic dataset 6 | X, y = make_classification(n_samples = 1800, n_features = 2, n_informative = 2, n_redundant = 0, n_clusters_per_class = 1, random_state=4) 7 | #Scatterplot 8 | for class_value in range(2): 9 | row_ix = where(y == class_value) 10 | pyplot.scatter(X[row_ix, 0], X[row_ix, 1]) 11 | #Display plot 12 | pyplot.xlabel('variable 1') 13 | pyplot.ylabel('variable 2') 14 | pyplot.title('Synthetic data graph') 15 | pyplot.show() 16 | -------------------------------------------------------------------------------- /Chapter15/diabetes.csv: -------------------------------------------------------------------------------- 1 | Pregnancies,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age,Outcome 2 | 6,148,72,35,0,33.6,0.627,50,1 3 | 1,85,66,29,0,26.6,0.351,31,0 4 | 8,183,64,0,0,23.3,0.672,32,1 5 | 1,89,66,23,94,28.1,0.167,21,0 6 | 0,137,40,35,168,43.1,2.288,33,1 7 | 5,116,74,0,0,25.6,0.201,30,0 8 | 3,78,50,32,88,31,0.248,26,1 9 | 10,115,0,0,0,35.3,0.134,29,0 10 | 2,197,70,45,543,30.5,0.158,53,1 11 | 8,125,96,0,0,0,0.232,54,1 12 | 4,110,92,0,0,37.6,0.191,30,0 13 | 10,168,74,0,0,38,0.537,34,1 14 | 10,139,80,0,0,27.1,1.441,57,0 15 | 1,189,60,23,846,30.1,0.398,59,1 16 | 5,166,72,19,175,25.8,0.587,51,1 17 | 7,100,0,0,0,30,0.484,32,1 18 | 0,118,84,47,230,45.8,0.551,31,1 19 | 7,107,74,0,0,29.6,0.254,31,1 20 | 1,103,30,38,83,43.3,0.183,33,0 21 | 1,115,70,30,96,34.6,0.529,32,1 22 | 3,126,88,41,235,39.3,0.704,27,0 23 | 8,99,84,0,0,35.4,0.388,50,0 24 | 7,196,90,0,0,39.8,0.451,41,1 25 | 9,119,80,35,0,29,0.263,29,1 26 | 11,143,94,33,146,36.6,0.254,51,1 27 | 10,125,70,26,115,31.1,0.205,41,1 28 | 7,147,76,0,0,39.4,0.257,43,1 29 | 1,97,66,15,140,23.2,0.487,22,0 30 | 13,145,82,19,110,22.2,0.245,57,0 31 | 5,117,92,0,0,34.1,0.337,38,0 32 | 5,109,75,26,0,36,0.546,60,0 33 | 3,158,76,36,245,31.6,0.851,28,1 34 | 3,88,58,11,54,24.8,0.267,22,0 35 | 6,92,92,0,0,19.9,0.188,28,0 36 | 10,122,78,31,0,27.6,0.512,45,0 37 | 4,103,60,33,192,24,0.966,33,0 38 | 11,138,76,0,0,33.2,0.42,35,0 39 | 9,102,76,37,0,32.9,0.665,46,1 40 | 2,90,68,42,0,38.2,0.503,27,1 41 | 4,111,72,47,207,37.1,1.39,56,1 42 | 3,180,64,25,70,34,0.271,26,0 43 | 7,133,84,0,0,40.2,0.696,37,0 44 | 7,106,92,18,0,22.7,0.235,48,0 45 | 9,171,110,24,240,45.4,0.721,54,1 46 | 7,159,64,0,0,27.4,0.294,40,0 47 | 0,180,66,39,0,42,1.893,25,1 48 | 1,146,56,0,0,29.7,0.564,29,0 49 | 2,71,70,27,0,28,0.586,22,0 50 | 7,103,66,32,0,39.1,0.344,31,1 51 | 7,105,0,0,0,0,0.305,24,0 52 | 1,103,80,11,82,19.4,0.491,22,0 53 | 1,101,50,15,36,24.2,0.526,26,0 54 | 5,88,66,21,23,24.4,0.342,30,0 55 | 8,176,90,34,300,33.7,0.467,58,1 56 | 7,150,66,42,342,34.7,0.718,42,0 57 | 1,73,50,10,0,23,0.248,21,0 58 | 7,187,68,39,304,37.7,0.254,41,1 59 | 0,100,88,60,110,46.8,0.962,31,0 60 | 0,146,82,0,0,40.5,1.781,44,0 61 | 0,105,64,41,142,41.5,0.173,22,0 62 | 2,84,0,0,0,0,0.304,21,0 63 | 8,133,72,0,0,32.9,0.27,39,1 64 | 5,44,62,0,0,25,0.587,36,0 65 | 2,141,58,34,128,25.4,0.699,24,0 66 | 7,114,66,0,0,32.8,0.258,42,1 67 | 5,99,74,27,0,29,0.203,32,0 68 | 0,109,88,30,0,32.5,0.855,38,1 69 | 2,109,92,0,0,42.7,0.845,54,0 70 | 1,95,66,13,38,19.6,0.334,25,0 71 | 4,146,85,27,100,28.9,0.189,27,0 72 | 2,100,66,20,90,32.9,0.867,28,1 73 | 5,139,64,35,140,28.6,0.411,26,0 74 | 13,126,90,0,0,43.4,0.583,42,1 75 | 4,129,86,20,270,35.1,0.231,23,0 76 | 1,79,75,30,0,32,0.396,22,0 77 | 1,0,48,20,0,24.7,0.14,22,0 78 | 7,62,78,0,0,32.6,0.391,41,0 79 | 5,95,72,33,0,37.7,0.37,27,0 80 | 0,131,0,0,0,43.2,0.27,26,1 81 | 2,112,66,22,0,25,0.307,24,0 82 | 3,113,44,13,0,22.4,0.14,22,0 83 | 2,74,0,0,0,0,0.102,22,0 84 | 7,83,78,26,71,29.3,0.767,36,0 85 | 0,101,65,28,0,24.6,0.237,22,0 86 | 5,137,108,0,0,48.8,0.227,37,1 87 | 2,110,74,29,125,32.4,0.698,27,0 88 | 13,106,72,54,0,36.6,0.178,45,0 89 | 2,100,68,25,71,38.5,0.324,26,0 90 | 15,136,70,32,110,37.1,0.153,43,1 91 | 1,107,68,19,0,26.5,0.165,24,0 92 | 1,80,55,0,0,19.1,0.258,21,0 93 | 4,123,80,15,176,32,0.443,34,0 94 | 7,81,78,40,48,46.7,0.261,42,0 95 | 4,134,72,0,0,23.8,0.277,60,1 96 | 2,142,82,18,64,24.7,0.761,21,0 97 | 6,144,72,27,228,33.9,0.255,40,0 98 | 2,92,62,28,0,31.6,0.13,24,0 99 | 1,71,48,18,76,20.4,0.323,22,0 100 | 6,93,50,30,64,28.7,0.356,23,0 101 | 1,122,90,51,220,49.7,0.325,31,1 102 | 1,163,72,0,0,39,1.222,33,1 103 | 1,151,60,0,0,26.1,0.179,22,0 104 | 0,125,96,0,0,22.5,0.262,21,0 105 | 1,81,72,18,40,26.6,0.283,24,0 106 | 2,85,65,0,0,39.6,0.93,27,0 107 | 1,126,56,29,152,28.7,0.801,21,0 108 | 1,96,122,0,0,22.4,0.207,27,0 109 | 4,144,58,28,140,29.5,0.287,37,0 110 | 3,83,58,31,18,34.3,0.336,25,0 111 | 0,95,85,25,36,37.4,0.247,24,1 112 | 3,171,72,33,135,33.3,0.199,24,1 113 | 8,155,62,26,495,34,0.543,46,1 114 | 1,89,76,34,37,31.2,0.192,23,0 115 | 4,76,62,0,0,34,0.391,25,0 116 | 7,160,54,32,175,30.5,0.588,39,1 117 | 4,146,92,0,0,31.2,0.539,61,1 118 | 5,124,74,0,0,34,0.22,38,1 119 | 5,78,48,0,0,33.7,0.654,25,0 120 | 4,97,60,23,0,28.2,0.443,22,0 121 | 4,99,76,15,51,23.2,0.223,21,0 122 | 0,162,76,56,100,53.2,0.759,25,1 123 | 6,111,64,39,0,34.2,0.26,24,0 124 | 2,107,74,30,100,33.6,0.404,23,0 125 | 5,132,80,0,0,26.8,0.186,69,0 126 | 0,113,76,0,0,33.3,0.278,23,1 127 | 1,88,30,42,99,55,0.496,26,1 128 | 3,120,70,30,135,42.9,0.452,30,0 129 | 1,118,58,36,94,33.3,0.261,23,0 130 | 1,117,88,24,145,34.5,0.403,40,1 131 | 0,105,84,0,0,27.9,0.741,62,1 132 | 4,173,70,14,168,29.7,0.361,33,1 133 | 9,122,56,0,0,33.3,1.114,33,1 134 | 3,170,64,37,225,34.5,0.356,30,1 135 | 8,84,74,31,0,38.3,0.457,39,0 136 | 2,96,68,13,49,21.1,0.647,26,0 137 | 2,125,60,20,140,33.8,0.088,31,0 138 | 0,100,70,26,50,30.8,0.597,21,0 139 | 0,93,60,25,92,28.7,0.532,22,0 140 | 0,129,80,0,0,31.2,0.703,29,0 141 | 5,105,72,29,325,36.9,0.159,28,0 142 | 3,128,78,0,0,21.1,0.268,55,0 143 | 5,106,82,30,0,39.5,0.286,38,0 144 | 2,108,52,26,63,32.5,0.318,22,0 145 | 10,108,66,0,0,32.4,0.272,42,1 146 | 4,154,62,31,284,32.8,0.237,23,0 147 | 0,102,75,23,0,0,0.572,21,0 148 | 9,57,80,37,0,32.8,0.096,41,0 149 | 2,106,64,35,119,30.5,1.4,34,0 150 | 5,147,78,0,0,33.7,0.218,65,0 151 | 2,90,70,17,0,27.3,0.085,22,0 152 | 1,136,74,50,204,37.4,0.399,24,0 153 | 4,114,65,0,0,21.9,0.432,37,0 154 | 9,156,86,28,155,34.3,1.189,42,1 155 | 1,153,82,42,485,40.6,0.687,23,0 156 | 8,188,78,0,0,47.9,0.137,43,1 157 | 7,152,88,44,0,50,0.337,36,1 158 | 2,99,52,15,94,24.6,0.637,21,0 159 | 1,109,56,21,135,25.2,0.833,23,0 160 | 2,88,74,19,53,29,0.229,22,0 161 | 17,163,72,41,114,40.9,0.817,47,1 162 | 4,151,90,38,0,29.7,0.294,36,0 163 | 7,102,74,40,105,37.2,0.204,45,0 164 | 0,114,80,34,285,44.2,0.167,27,0 165 | 2,100,64,23,0,29.7,0.368,21,0 166 | 0,131,88,0,0,31.6,0.743,32,1 167 | 6,104,74,18,156,29.9,0.722,41,1 168 | 3,148,66,25,0,32.5,0.256,22,0 169 | 4,120,68,0,0,29.6,0.709,34,0 170 | 4,110,66,0,0,31.9,0.471,29,0 171 | 3,111,90,12,78,28.4,0.495,29,0 172 | 6,102,82,0,0,30.8,0.18,36,1 173 | 6,134,70,23,130,35.4,0.542,29,1 174 | 2,87,0,23,0,28.9,0.773,25,0 175 | 1,79,60,42,48,43.5,0.678,23,0 176 | 2,75,64,24,55,29.7,0.37,33,0 177 | 8,179,72,42,130,32.7,0.719,36,1 178 | 6,85,78,0,0,31.2,0.382,42,0 179 | 0,129,110,46,130,67.1,0.319,26,1 180 | 5,143,78,0,0,45,0.19,47,0 181 | 5,130,82,0,0,39.1,0.956,37,1 182 | 6,87,80,0,0,23.2,0.084,32,0 183 | 0,119,64,18,92,34.9,0.725,23,0 184 | 1,0,74,20,23,27.7,0.299,21,0 185 | 5,73,60,0,0,26.8,0.268,27,0 186 | 4,141,74,0,0,27.6,0.244,40,0 187 | 7,194,68,28,0,35.9,0.745,41,1 188 | 8,181,68,36,495,30.1,0.615,60,1 189 | 1,128,98,41,58,32,1.321,33,1 190 | 8,109,76,39,114,27.9,0.64,31,1 191 | 5,139,80,35,160,31.6,0.361,25,1 192 | 3,111,62,0,0,22.6,0.142,21,0 193 | 9,123,70,44,94,33.1,0.374,40,0 194 | 7,159,66,0,0,30.4,0.383,36,1 195 | 11,135,0,0,0,52.3,0.578,40,1 196 | 8,85,55,20,0,24.4,0.136,42,0 197 | 5,158,84,41,210,39.4,0.395,29,1 198 | 1,105,58,0,0,24.3,0.187,21,0 199 | 3,107,62,13,48,22.9,0.678,23,1 200 | 4,109,64,44,99,34.8,0.905,26,1 201 | 4,148,60,27,318,30.9,0.15,29,1 202 | 0,113,80,16,0,31,0.874,21,0 203 | 1,138,82,0,0,40.1,0.236,28,0 204 | 0,108,68,20,0,27.3,0.787,32,0 205 | 2,99,70,16,44,20.4,0.235,27,0 206 | 6,103,72,32,190,37.7,0.324,55,0 207 | 5,111,72,28,0,23.9,0.407,27,0 208 | 8,196,76,29,280,37.5,0.605,57,1 209 | 5,162,104,0,0,37.7,0.151,52,1 210 | 1,96,64,27,87,33.2,0.289,21,0 211 | 7,184,84,33,0,35.5,0.355,41,1 212 | 2,81,60,22,0,27.7,0.29,25,0 213 | 0,147,85,54,0,42.8,0.375,24,0 214 | 7,179,95,31,0,34.2,0.164,60,0 215 | 0,140,65,26,130,42.6,0.431,24,1 216 | 9,112,82,32,175,34.2,0.26,36,1 217 | 12,151,70,40,271,41.8,0.742,38,1 218 | 5,109,62,41,129,35.8,0.514,25,1 219 | 6,125,68,30,120,30,0.464,32,0 220 | 5,85,74,22,0,29,1.224,32,1 221 | 5,112,66,0,0,37.8,0.261,41,1 222 | 0,177,60,29,478,34.6,1.072,21,1 223 | 2,158,90,0,0,31.6,0.805,66,1 224 | 7,119,0,0,0,25.2,0.209,37,0 225 | 7,142,60,33,190,28.8,0.687,61,0 226 | 1,100,66,15,56,23.6,0.666,26,0 227 | 1,87,78,27,32,34.6,0.101,22,0 228 | 0,101,76,0,0,35.7,0.198,26,0 229 | 3,162,52,38,0,37.2,0.652,24,1 230 | 4,197,70,39,744,36.7,2.329,31,0 231 | 0,117,80,31,53,45.2,0.089,24,0 232 | 4,142,86,0,0,44,0.645,22,1 233 | 6,134,80,37,370,46.2,0.238,46,1 234 | 1,79,80,25,37,25.4,0.583,22,0 235 | 4,122,68,0,0,35,0.394,29,0 236 | 3,74,68,28,45,29.7,0.293,23,0 237 | 4,171,72,0,0,43.6,0.479,26,1 238 | 7,181,84,21,192,35.9,0.586,51,1 239 | 0,179,90,27,0,44.1,0.686,23,1 240 | 9,164,84,21,0,30.8,0.831,32,1 241 | 0,104,76,0,0,18.4,0.582,27,0 242 | 1,91,64,24,0,29.2,0.192,21,0 243 | 4,91,70,32,88,33.1,0.446,22,0 244 | 3,139,54,0,0,25.6,0.402,22,1 245 | 6,119,50,22,176,27.1,1.318,33,1 246 | 2,146,76,35,194,38.2,0.329,29,0 247 | 9,184,85,15,0,30,1.213,49,1 248 | 10,122,68,0,0,31.2,0.258,41,0 249 | 0,165,90,33,680,52.3,0.427,23,0 250 | 9,124,70,33,402,35.4,0.282,34,0 251 | 1,111,86,19,0,30.1,0.143,23,0 252 | 9,106,52,0,0,31.2,0.38,42,0 253 | 2,129,84,0,0,28,0.284,27,0 254 | 2,90,80,14,55,24.4,0.249,24,0 255 | 0,86,68,32,0,35.8,0.238,25,0 256 | 12,92,62,7,258,27.6,0.926,44,1 257 | 1,113,64,35,0,33.6,0.543,21,1 258 | 3,111,56,39,0,30.1,0.557,30,0 259 | 2,114,68,22,0,28.7,0.092,25,0 260 | 1,193,50,16,375,25.9,0.655,24,0 261 | 11,155,76,28,150,33.3,1.353,51,1 262 | 3,191,68,15,130,30.9,0.299,34,0 263 | 3,141,0,0,0,30,0.761,27,1 264 | 4,95,70,32,0,32.1,0.612,24,0 265 | 3,142,80,15,0,32.4,0.2,63,0 266 | 4,123,62,0,0,32,0.226,35,1 267 | 5,96,74,18,67,33.6,0.997,43,0 268 | 0,138,0,0,0,36.3,0.933,25,1 269 | 2,128,64,42,0,40,1.101,24,0 270 | 0,102,52,0,0,25.1,0.078,21,0 271 | 2,146,0,0,0,27.5,0.24,28,1 272 | 10,101,86,37,0,45.6,1.136,38,1 273 | 2,108,62,32,56,25.2,0.128,21,0 274 | 3,122,78,0,0,23,0.254,40,0 275 | 1,71,78,50,45,33.2,0.422,21,0 276 | 13,106,70,0,0,34.2,0.251,52,0 277 | 2,100,70,52,57,40.5,0.677,25,0 278 | 7,106,60,24,0,26.5,0.296,29,1 279 | 0,104,64,23,116,27.8,0.454,23,0 280 | 5,114,74,0,0,24.9,0.744,57,0 281 | 2,108,62,10,278,25.3,0.881,22,0 282 | 0,146,70,0,0,37.9,0.334,28,1 283 | 10,129,76,28,122,35.9,0.28,39,0 284 | 7,133,88,15,155,32.4,0.262,37,0 285 | 7,161,86,0,0,30.4,0.165,47,1 286 | 2,108,80,0,0,27,0.259,52,1 287 | 7,136,74,26,135,26,0.647,51,0 288 | 5,155,84,44,545,38.7,0.619,34,0 289 | 1,119,86,39,220,45.6,0.808,29,1 290 | 4,96,56,17,49,20.8,0.34,26,0 291 | 5,108,72,43,75,36.1,0.263,33,0 292 | 0,78,88,29,40,36.9,0.434,21,0 293 | 0,107,62,30,74,36.6,0.757,25,1 294 | 2,128,78,37,182,43.3,1.224,31,1 295 | 1,128,48,45,194,40.5,0.613,24,1 296 | 0,161,50,0,0,21.9,0.254,65,0 297 | 6,151,62,31,120,35.5,0.692,28,0 298 | 2,146,70,38,360,28,0.337,29,1 299 | 0,126,84,29,215,30.7,0.52,24,0 300 | 14,100,78,25,184,36.6,0.412,46,1 301 | 8,112,72,0,0,23.6,0.84,58,0 302 | 0,167,0,0,0,32.3,0.839,30,1 303 | 2,144,58,33,135,31.6,0.422,25,1 304 | 5,77,82,41,42,35.8,0.156,35,0 305 | 5,115,98,0,0,52.9,0.209,28,1 306 | 3,150,76,0,0,21,0.207,37,0 307 | 2,120,76,37,105,39.7,0.215,29,0 308 | 10,161,68,23,132,25.5,0.326,47,1 309 | 0,137,68,14,148,24.8,0.143,21,0 310 | 0,128,68,19,180,30.5,1.391,25,1 311 | 2,124,68,28,205,32.9,0.875,30,1 312 | 6,80,66,30,0,26.2,0.313,41,0 313 | 0,106,70,37,148,39.4,0.605,22,0 314 | 2,155,74,17,96,26.6,0.433,27,1 315 | 3,113,50,10,85,29.5,0.626,25,0 316 | 7,109,80,31,0,35.9,1.127,43,1 317 | 2,112,68,22,94,34.1,0.315,26,0 318 | 3,99,80,11,64,19.3,0.284,30,0 319 | 3,182,74,0,0,30.5,0.345,29,1 320 | 3,115,66,39,140,38.1,0.15,28,0 321 | 6,194,78,0,0,23.5,0.129,59,1 322 | 4,129,60,12,231,27.5,0.527,31,0 323 | 3,112,74,30,0,31.6,0.197,25,1 324 | 0,124,70,20,0,27.4,0.254,36,1 325 | 13,152,90,33,29,26.8,0.731,43,1 326 | 2,112,75,32,0,35.7,0.148,21,0 327 | 1,157,72,21,168,25.6,0.123,24,0 328 | 1,122,64,32,156,35.1,0.692,30,1 329 | 10,179,70,0,0,35.1,0.2,37,0 330 | 2,102,86,36,120,45.5,0.127,23,1 331 | 6,105,70,32,68,30.8,0.122,37,0 332 | 8,118,72,19,0,23.1,1.476,46,0 333 | 2,87,58,16,52,32.7,0.166,25,0 334 | 1,180,0,0,0,43.3,0.282,41,1 335 | 12,106,80,0,0,23.6,0.137,44,0 336 | 1,95,60,18,58,23.9,0.26,22,0 337 | 0,165,76,43,255,47.9,0.259,26,0 338 | 0,117,0,0,0,33.8,0.932,44,0 339 | 5,115,76,0,0,31.2,0.343,44,1 340 | 9,152,78,34,171,34.2,0.893,33,1 341 | 7,178,84,0,0,39.9,0.331,41,1 342 | 1,130,70,13,105,25.9,0.472,22,0 343 | 1,95,74,21,73,25.9,0.673,36,0 344 | 1,0,68,35,0,32,0.389,22,0 345 | 5,122,86,0,0,34.7,0.29,33,0 346 | 8,95,72,0,0,36.8,0.485,57,0 347 | 8,126,88,36,108,38.5,0.349,49,0 348 | 1,139,46,19,83,28.7,0.654,22,0 349 | 3,116,0,0,0,23.5,0.187,23,0 350 | 3,99,62,19,74,21.8,0.279,26,0 351 | 5,0,80,32,0,41,0.346,37,1 352 | 4,92,80,0,0,42.2,0.237,29,0 353 | 4,137,84,0,0,31.2,0.252,30,0 354 | 3,61,82,28,0,34.4,0.243,46,0 355 | 1,90,62,12,43,27.2,0.58,24,0 356 | 3,90,78,0,0,42.7,0.559,21,0 357 | 9,165,88,0,0,30.4,0.302,49,1 358 | 1,125,50,40,167,33.3,0.962,28,1 359 | 13,129,0,30,0,39.9,0.569,44,1 360 | 12,88,74,40,54,35.3,0.378,48,0 361 | 1,196,76,36,249,36.5,0.875,29,1 362 | 5,189,64,33,325,31.2,0.583,29,1 363 | 5,158,70,0,0,29.8,0.207,63,0 364 | 5,103,108,37,0,39.2,0.305,65,0 365 | 4,146,78,0,0,38.5,0.52,67,1 366 | 4,147,74,25,293,34.9,0.385,30,0 367 | 5,99,54,28,83,34,0.499,30,0 368 | 6,124,72,0,0,27.6,0.368,29,1 369 | 0,101,64,17,0,21,0.252,21,0 370 | 3,81,86,16,66,27.5,0.306,22,0 371 | 1,133,102,28,140,32.8,0.234,45,1 372 | 3,173,82,48,465,38.4,2.137,25,1 373 | 0,118,64,23,89,0,1.731,21,0 374 | 0,84,64,22,66,35.8,0.545,21,0 375 | 2,105,58,40,94,34.9,0.225,25,0 376 | 2,122,52,43,158,36.2,0.816,28,0 377 | 12,140,82,43,325,39.2,0.528,58,1 378 | 0,98,82,15,84,25.2,0.299,22,0 379 | 1,87,60,37,75,37.2,0.509,22,0 380 | 4,156,75,0,0,48.3,0.238,32,1 381 | 0,93,100,39,72,43.4,1.021,35,0 382 | 1,107,72,30,82,30.8,0.821,24,0 383 | 0,105,68,22,0,20,0.236,22,0 384 | 1,109,60,8,182,25.4,0.947,21,0 385 | 1,90,62,18,59,25.1,1.268,25,0 386 | 1,125,70,24,110,24.3,0.221,25,0 387 | 1,119,54,13,50,22.3,0.205,24,0 388 | 5,116,74,29,0,32.3,0.66,35,1 389 | 8,105,100,36,0,43.3,0.239,45,1 390 | 5,144,82,26,285,32,0.452,58,1 391 | 3,100,68,23,81,31.6,0.949,28,0 392 | 1,100,66,29,196,32,0.444,42,0 393 | 5,166,76,0,0,45.7,0.34,27,1 394 | 1,131,64,14,415,23.7,0.389,21,0 395 | 4,116,72,12,87,22.1,0.463,37,0 396 | 4,158,78,0,0,32.9,0.803,31,1 397 | 2,127,58,24,275,27.7,1.6,25,0 398 | 3,96,56,34,115,24.7,0.944,39,0 399 | 0,131,66,40,0,34.3,0.196,22,1 400 | 3,82,70,0,0,21.1,0.389,25,0 401 | 3,193,70,31,0,34.9,0.241,25,1 402 | 4,95,64,0,0,32,0.161,31,1 403 | 6,137,61,0,0,24.2,0.151,55,0 404 | 5,136,84,41,88,35,0.286,35,1 405 | 9,72,78,25,0,31.6,0.28,38,0 406 | 5,168,64,0,0,32.9,0.135,41,1 407 | 2,123,48,32,165,42.1,0.52,26,0 408 | 4,115,72,0,0,28.9,0.376,46,1 409 | 0,101,62,0,0,21.9,0.336,25,0 410 | 8,197,74,0,0,25.9,1.191,39,1 411 | 1,172,68,49,579,42.4,0.702,28,1 412 | 6,102,90,39,0,35.7,0.674,28,0 413 | 1,112,72,30,176,34.4,0.528,25,0 414 | 1,143,84,23,310,42.4,1.076,22,0 415 | 1,143,74,22,61,26.2,0.256,21,0 416 | 0,138,60,35,167,34.6,0.534,21,1 417 | 3,173,84,33,474,35.7,0.258,22,1 418 | 1,97,68,21,0,27.2,1.095,22,0 419 | 4,144,82,32,0,38.5,0.554,37,1 420 | 1,83,68,0,0,18.2,0.624,27,0 421 | 3,129,64,29,115,26.4,0.219,28,1 422 | 1,119,88,41,170,45.3,0.507,26,0 423 | 2,94,68,18,76,26,0.561,21,0 424 | 0,102,64,46,78,40.6,0.496,21,0 425 | 2,115,64,22,0,30.8,0.421,21,0 426 | 8,151,78,32,210,42.9,0.516,36,1 427 | 4,184,78,39,277,37,0.264,31,1 428 | 0,94,0,0,0,0,0.256,25,0 429 | 1,181,64,30,180,34.1,0.328,38,1 430 | 0,135,94,46,145,40.6,0.284,26,0 431 | 1,95,82,25,180,35,0.233,43,1 432 | 2,99,0,0,0,22.2,0.108,23,0 433 | 3,89,74,16,85,30.4,0.551,38,0 434 | 1,80,74,11,60,30,0.527,22,0 435 | 2,139,75,0,0,25.6,0.167,29,0 436 | 1,90,68,8,0,24.5,1.138,36,0 437 | 0,141,0,0,0,42.4,0.205,29,1 438 | 12,140,85,33,0,37.4,0.244,41,0 439 | 5,147,75,0,0,29.9,0.434,28,0 440 | 1,97,70,15,0,18.2,0.147,21,0 441 | 6,107,88,0,0,36.8,0.727,31,0 442 | 0,189,104,25,0,34.3,0.435,41,1 443 | 2,83,66,23,50,32.2,0.497,22,0 444 | 4,117,64,27,120,33.2,0.23,24,0 445 | 8,108,70,0,0,30.5,0.955,33,1 446 | 4,117,62,12,0,29.7,0.38,30,1 447 | 0,180,78,63,14,59.4,2.42,25,1 448 | 1,100,72,12,70,25.3,0.658,28,0 449 | 0,95,80,45,92,36.5,0.33,26,0 450 | 0,104,64,37,64,33.6,0.51,22,1 451 | 0,120,74,18,63,30.5,0.285,26,0 452 | 1,82,64,13,95,21.2,0.415,23,0 453 | 2,134,70,0,0,28.9,0.542,23,1 454 | 0,91,68,32,210,39.9,0.381,25,0 455 | 2,119,0,0,0,19.6,0.832,72,0 456 | 2,100,54,28,105,37.8,0.498,24,0 457 | 14,175,62,30,0,33.6,0.212,38,1 458 | 1,135,54,0,0,26.7,0.687,62,0 459 | 5,86,68,28,71,30.2,0.364,24,0 460 | 10,148,84,48,237,37.6,1.001,51,1 461 | 9,134,74,33,60,25.9,0.46,81,0 462 | 9,120,72,22,56,20.8,0.733,48,0 463 | 1,71,62,0,0,21.8,0.416,26,0 464 | 8,74,70,40,49,35.3,0.705,39,0 465 | 5,88,78,30,0,27.6,0.258,37,0 466 | 10,115,98,0,0,24,1.022,34,0 467 | 0,124,56,13,105,21.8,0.452,21,0 468 | 0,74,52,10,36,27.8,0.269,22,0 469 | 0,97,64,36,100,36.8,0.6,25,0 470 | 8,120,0,0,0,30,0.183,38,1 471 | 6,154,78,41,140,46.1,0.571,27,0 472 | 1,144,82,40,0,41.3,0.607,28,0 473 | 0,137,70,38,0,33.2,0.17,22,0 474 | 0,119,66,27,0,38.8,0.259,22,0 475 | 7,136,90,0,0,29.9,0.21,50,0 476 | 4,114,64,0,0,28.9,0.126,24,0 477 | 0,137,84,27,0,27.3,0.231,59,0 478 | 2,105,80,45,191,33.7,0.711,29,1 479 | 7,114,76,17,110,23.8,0.466,31,0 480 | 8,126,74,38,75,25.9,0.162,39,0 481 | 4,132,86,31,0,28,0.419,63,0 482 | 3,158,70,30,328,35.5,0.344,35,1 483 | 0,123,88,37,0,35.2,0.197,29,0 484 | 4,85,58,22,49,27.8,0.306,28,0 485 | 0,84,82,31,125,38.2,0.233,23,0 486 | 0,145,0,0,0,44.2,0.63,31,1 487 | 0,135,68,42,250,42.3,0.365,24,1 488 | 1,139,62,41,480,40.7,0.536,21,0 489 | 0,173,78,32,265,46.5,1.159,58,0 490 | 4,99,72,17,0,25.6,0.294,28,0 491 | 8,194,80,0,0,26.1,0.551,67,0 492 | 2,83,65,28,66,36.8,0.629,24,0 493 | 2,89,90,30,0,33.5,0.292,42,0 494 | 4,99,68,38,0,32.8,0.145,33,0 495 | 4,125,70,18,122,28.9,1.144,45,1 496 | 3,80,0,0,0,0,0.174,22,0 497 | 6,166,74,0,0,26.6,0.304,66,0 498 | 5,110,68,0,0,26,0.292,30,0 499 | 2,81,72,15,76,30.1,0.547,25,0 500 | 7,195,70,33,145,25.1,0.163,55,1 501 | 6,154,74,32,193,29.3,0.839,39,0 502 | 2,117,90,19,71,25.2,0.313,21,0 503 | 3,84,72,32,0,37.2,0.267,28,0 504 | 6,0,68,41,0,39,0.727,41,1 505 | 7,94,64,25,79,33.3,0.738,41,0 506 | 3,96,78,39,0,37.3,0.238,40,0 507 | 10,75,82,0,0,33.3,0.263,38,0 508 | 0,180,90,26,90,36.5,0.314,35,1 509 | 1,130,60,23,170,28.6,0.692,21,0 510 | 2,84,50,23,76,30.4,0.968,21,0 511 | 8,120,78,0,0,25,0.409,64,0 512 | 12,84,72,31,0,29.7,0.297,46,1 513 | 0,139,62,17,210,22.1,0.207,21,0 514 | 9,91,68,0,0,24.2,0.2,58,0 515 | 2,91,62,0,0,27.3,0.525,22,0 516 | 3,99,54,19,86,25.6,0.154,24,0 517 | 3,163,70,18,105,31.6,0.268,28,1 518 | 9,145,88,34,165,30.3,0.771,53,1 519 | 7,125,86,0,0,37.6,0.304,51,0 520 | 13,76,60,0,0,32.8,0.18,41,0 521 | 6,129,90,7,326,19.6,0.582,60,0 522 | 2,68,70,32,66,25,0.187,25,0 523 | 3,124,80,33,130,33.2,0.305,26,0 524 | 6,114,0,0,0,0,0.189,26,0 525 | 9,130,70,0,0,34.2,0.652,45,1 526 | 3,125,58,0,0,31.6,0.151,24,0 527 | 3,87,60,18,0,21.8,0.444,21,0 528 | 1,97,64,19,82,18.2,0.299,21,0 529 | 3,116,74,15,105,26.3,0.107,24,0 530 | 0,117,66,31,188,30.8,0.493,22,0 531 | 0,111,65,0,0,24.6,0.66,31,0 532 | 2,122,60,18,106,29.8,0.717,22,0 533 | 0,107,76,0,0,45.3,0.686,24,0 534 | 1,86,66,52,65,41.3,0.917,29,0 535 | 6,91,0,0,0,29.8,0.501,31,0 536 | 1,77,56,30,56,33.3,1.251,24,0 537 | 4,132,0,0,0,32.9,0.302,23,1 538 | 0,105,90,0,0,29.6,0.197,46,0 539 | 0,57,60,0,0,21.7,0.735,67,0 540 | 0,127,80,37,210,36.3,0.804,23,0 541 | 3,129,92,49,155,36.4,0.968,32,1 542 | 8,100,74,40,215,39.4,0.661,43,1 543 | 3,128,72,25,190,32.4,0.549,27,1 544 | 10,90,85,32,0,34.9,0.825,56,1 545 | 4,84,90,23,56,39.5,0.159,25,0 546 | 1,88,78,29,76,32,0.365,29,0 547 | 8,186,90,35,225,34.5,0.423,37,1 548 | 5,187,76,27,207,43.6,1.034,53,1 549 | 4,131,68,21,166,33.1,0.16,28,0 550 | 1,164,82,43,67,32.8,0.341,50,0 551 | 4,189,110,31,0,28.5,0.68,37,0 552 | 1,116,70,28,0,27.4,0.204,21,0 553 | 3,84,68,30,106,31.9,0.591,25,0 554 | 6,114,88,0,0,27.8,0.247,66,0 555 | 1,88,62,24,44,29.9,0.422,23,0 556 | 1,84,64,23,115,36.9,0.471,28,0 557 | 7,124,70,33,215,25.5,0.161,37,0 558 | 1,97,70,40,0,38.1,0.218,30,0 559 | 8,110,76,0,0,27.8,0.237,58,0 560 | 11,103,68,40,0,46.2,0.126,42,0 561 | 11,85,74,0,0,30.1,0.3,35,0 562 | 6,125,76,0,0,33.8,0.121,54,1 563 | 0,198,66,32,274,41.3,0.502,28,1 564 | 1,87,68,34,77,37.6,0.401,24,0 565 | 6,99,60,19,54,26.9,0.497,32,0 566 | 0,91,80,0,0,32.4,0.601,27,0 567 | 2,95,54,14,88,26.1,0.748,22,0 568 | 1,99,72,30,18,38.6,0.412,21,0 569 | 6,92,62,32,126,32,0.085,46,0 570 | 4,154,72,29,126,31.3,0.338,37,0 571 | 0,121,66,30,165,34.3,0.203,33,1 572 | 3,78,70,0,0,32.5,0.27,39,0 573 | 2,130,96,0,0,22.6,0.268,21,0 574 | 3,111,58,31,44,29.5,0.43,22,0 575 | 2,98,60,17,120,34.7,0.198,22,0 576 | 1,143,86,30,330,30.1,0.892,23,0 577 | 1,119,44,47,63,35.5,0.28,25,0 578 | 6,108,44,20,130,24,0.813,35,0 579 | 2,118,80,0,0,42.9,0.693,21,1 580 | 10,133,68,0,0,27,0.245,36,0 581 | 2,197,70,99,0,34.7,0.575,62,1 582 | 0,151,90,46,0,42.1,0.371,21,1 583 | 6,109,60,27,0,25,0.206,27,0 584 | 12,121,78,17,0,26.5,0.259,62,0 585 | 8,100,76,0,0,38.7,0.19,42,0 586 | 8,124,76,24,600,28.7,0.687,52,1 587 | 1,93,56,11,0,22.5,0.417,22,0 588 | 8,143,66,0,0,34.9,0.129,41,1 589 | 6,103,66,0,0,24.3,0.249,29,0 590 | 3,176,86,27,156,33.3,1.154,52,1 591 | 0,73,0,0,0,21.1,0.342,25,0 592 | 11,111,84,40,0,46.8,0.925,45,1 593 | 2,112,78,50,140,39.4,0.175,24,0 594 | 3,132,80,0,0,34.4,0.402,44,1 595 | 2,82,52,22,115,28.5,1.699,25,0 596 | 6,123,72,45,230,33.6,0.733,34,0 597 | 0,188,82,14,185,32,0.682,22,1 598 | 0,67,76,0,0,45.3,0.194,46,0 599 | 1,89,24,19,25,27.8,0.559,21,0 600 | 1,173,74,0,0,36.8,0.088,38,1 601 | 1,109,38,18,120,23.1,0.407,26,0 602 | 1,108,88,19,0,27.1,0.4,24,0 603 | 6,96,0,0,0,23.7,0.19,28,0 604 | 1,124,74,36,0,27.8,0.1,30,0 605 | 7,150,78,29,126,35.2,0.692,54,1 606 | 4,183,0,0,0,28.4,0.212,36,1 607 | 1,124,60,32,0,35.8,0.514,21,0 608 | 1,181,78,42,293,40,1.258,22,1 609 | 1,92,62,25,41,19.5,0.482,25,0 610 | 0,152,82,39,272,41.5,0.27,27,0 611 | 1,111,62,13,182,24,0.138,23,0 612 | 3,106,54,21,158,30.9,0.292,24,0 613 | 3,174,58,22,194,32.9,0.593,36,1 614 | 7,168,88,42,321,38.2,0.787,40,1 615 | 6,105,80,28,0,32.5,0.878,26,0 616 | 11,138,74,26,144,36.1,0.557,50,1 617 | 3,106,72,0,0,25.8,0.207,27,0 618 | 6,117,96,0,0,28.7,0.157,30,0 619 | 2,68,62,13,15,20.1,0.257,23,0 620 | 9,112,82,24,0,28.2,1.282,50,1 621 | 0,119,0,0,0,32.4,0.141,24,1 622 | 2,112,86,42,160,38.4,0.246,28,0 623 | 2,92,76,20,0,24.2,1.698,28,0 624 | 6,183,94,0,0,40.8,1.461,45,0 625 | 0,94,70,27,115,43.5,0.347,21,0 626 | 2,108,64,0,0,30.8,0.158,21,0 627 | 4,90,88,47,54,37.7,0.362,29,0 628 | 0,125,68,0,0,24.7,0.206,21,0 629 | 0,132,78,0,0,32.4,0.393,21,0 630 | 5,128,80,0,0,34.6,0.144,45,0 631 | 4,94,65,22,0,24.7,0.148,21,0 632 | 7,114,64,0,0,27.4,0.732,34,1 633 | 0,102,78,40,90,34.5,0.238,24,0 634 | 2,111,60,0,0,26.2,0.343,23,0 635 | 1,128,82,17,183,27.5,0.115,22,0 636 | 10,92,62,0,0,25.9,0.167,31,0 637 | 13,104,72,0,0,31.2,0.465,38,1 638 | 5,104,74,0,0,28.8,0.153,48,0 639 | 2,94,76,18,66,31.6,0.649,23,0 640 | 7,97,76,32,91,40.9,0.871,32,1 641 | 1,100,74,12,46,19.5,0.149,28,0 642 | 0,102,86,17,105,29.3,0.695,27,0 643 | 4,128,70,0,0,34.3,0.303,24,0 644 | 6,147,80,0,0,29.5,0.178,50,1 645 | 4,90,0,0,0,28,0.61,31,0 646 | 3,103,72,30,152,27.6,0.73,27,0 647 | 2,157,74,35,440,39.4,0.134,30,0 648 | 1,167,74,17,144,23.4,0.447,33,1 649 | 0,179,50,36,159,37.8,0.455,22,1 650 | 11,136,84,35,130,28.3,0.26,42,1 651 | 0,107,60,25,0,26.4,0.133,23,0 652 | 1,91,54,25,100,25.2,0.234,23,0 653 | 1,117,60,23,106,33.8,0.466,27,0 654 | 5,123,74,40,77,34.1,0.269,28,0 655 | 2,120,54,0,0,26.8,0.455,27,0 656 | 1,106,70,28,135,34.2,0.142,22,0 657 | 2,155,52,27,540,38.7,0.24,25,1 658 | 2,101,58,35,90,21.8,0.155,22,0 659 | 1,120,80,48,200,38.9,1.162,41,0 660 | 11,127,106,0,0,39,0.19,51,0 661 | 3,80,82,31,70,34.2,1.292,27,1 662 | 10,162,84,0,0,27.7,0.182,54,0 663 | 1,199,76,43,0,42.9,1.394,22,1 664 | 8,167,106,46,231,37.6,0.165,43,1 665 | 9,145,80,46,130,37.9,0.637,40,1 666 | 6,115,60,39,0,33.7,0.245,40,1 667 | 1,112,80,45,132,34.8,0.217,24,0 668 | 4,145,82,18,0,32.5,0.235,70,1 669 | 10,111,70,27,0,27.5,0.141,40,1 670 | 6,98,58,33,190,34,0.43,43,0 671 | 9,154,78,30,100,30.9,0.164,45,0 672 | 6,165,68,26,168,33.6,0.631,49,0 673 | 1,99,58,10,0,25.4,0.551,21,0 674 | 10,68,106,23,49,35.5,0.285,47,0 675 | 3,123,100,35,240,57.3,0.88,22,0 676 | 8,91,82,0,0,35.6,0.587,68,0 677 | 6,195,70,0,0,30.9,0.328,31,1 678 | 9,156,86,0,0,24.8,0.23,53,1 679 | 0,93,60,0,0,35.3,0.263,25,0 680 | 3,121,52,0,0,36,0.127,25,1 681 | 2,101,58,17,265,24.2,0.614,23,0 682 | 2,56,56,28,45,24.2,0.332,22,0 683 | 0,162,76,36,0,49.6,0.364,26,1 684 | 0,95,64,39,105,44.6,0.366,22,0 685 | 4,125,80,0,0,32.3,0.536,27,1 686 | 5,136,82,0,0,0,0.64,69,0 687 | 2,129,74,26,205,33.2,0.591,25,0 688 | 3,130,64,0,0,23.1,0.314,22,0 689 | 1,107,50,19,0,28.3,0.181,29,0 690 | 1,140,74,26,180,24.1,0.828,23,0 691 | 1,144,82,46,180,46.1,0.335,46,1 692 | 8,107,80,0,0,24.6,0.856,34,0 693 | 13,158,114,0,0,42.3,0.257,44,1 694 | 2,121,70,32,95,39.1,0.886,23,0 695 | 7,129,68,49,125,38.5,0.439,43,1 696 | 2,90,60,0,0,23.5,0.191,25,0 697 | 7,142,90,24,480,30.4,0.128,43,1 698 | 3,169,74,19,125,29.9,0.268,31,1 699 | 0,99,0,0,0,25,0.253,22,0 700 | 4,127,88,11,155,34.5,0.598,28,0 701 | 4,118,70,0,0,44.5,0.904,26,0 702 | 2,122,76,27,200,35.9,0.483,26,0 703 | 6,125,78,31,0,27.6,0.565,49,1 704 | 1,168,88,29,0,35,0.905,52,1 705 | 2,129,0,0,0,38.5,0.304,41,0 706 | 4,110,76,20,100,28.4,0.118,27,0 707 | 6,80,80,36,0,39.8,0.177,28,0 708 | 10,115,0,0,0,0,0.261,30,1 709 | 2,127,46,21,335,34.4,0.176,22,0 710 | 9,164,78,0,0,32.8,0.148,45,1 711 | 2,93,64,32,160,38,0.674,23,1 712 | 3,158,64,13,387,31.2,0.295,24,0 713 | 5,126,78,27,22,29.6,0.439,40,0 714 | 10,129,62,36,0,41.2,0.441,38,1 715 | 0,134,58,20,291,26.4,0.352,21,0 716 | 3,102,74,0,0,29.5,0.121,32,0 717 | 7,187,50,33,392,33.9,0.826,34,1 718 | 3,173,78,39,185,33.8,0.97,31,1 719 | 10,94,72,18,0,23.1,0.595,56,0 720 | 1,108,60,46,178,35.5,0.415,24,0 721 | 5,97,76,27,0,35.6,0.378,52,1 722 | 4,83,86,19,0,29.3,0.317,34,0 723 | 1,114,66,36,200,38.1,0.289,21,0 724 | 1,149,68,29,127,29.3,0.349,42,1 725 | 5,117,86,30,105,39.1,0.251,42,0 726 | 1,111,94,0,0,32.8,0.265,45,0 727 | 4,112,78,40,0,39.4,0.236,38,0 728 | 1,116,78,29,180,36.1,0.496,25,0 729 | 0,141,84,26,0,32.4,0.433,22,0 730 | 2,175,88,0,0,22.9,0.326,22,0 731 | 2,92,52,0,0,30.1,0.141,22,0 732 | 3,130,78,23,79,28.4,0.323,34,1 733 | 8,120,86,0,0,28.4,0.259,22,1 734 | 2,174,88,37,120,44.5,0.646,24,1 735 | 2,106,56,27,165,29,0.426,22,0 736 | 2,105,75,0,0,23.3,0.56,53,0 737 | 4,95,60,32,0,35.4,0.284,28,0 738 | 0,126,86,27,120,27.4,0.515,21,0 739 | 8,65,72,23,0,32,0.6,42,0 740 | 2,99,60,17,160,36.6,0.453,21,0 741 | 1,102,74,0,0,39.5,0.293,42,1 742 | 11,120,80,37,150,42.3,0.785,48,1 743 | 3,102,44,20,94,30.8,0.4,26,0 744 | 1,109,58,18,116,28.5,0.219,22,0 745 | 9,140,94,0,0,32.7,0.734,45,1 746 | 13,153,88,37,140,40.6,1.174,39,0 747 | 12,100,84,33,105,30,0.488,46,0 748 | 1,147,94,41,0,49.3,0.358,27,1 749 | 1,81,74,41,57,46.3,1.096,32,0 750 | 3,187,70,22,200,36.4,0.408,36,1 751 | 6,162,62,0,0,24.3,0.178,50,1 752 | 4,136,70,0,0,31.2,1.182,22,1 753 | 1,121,78,39,74,39,0.261,28,0 754 | 3,108,62,24,0,26,0.223,25,0 755 | 0,181,88,44,510,43.3,0.222,26,1 756 | 8,154,78,32,0,32.4,0.443,45,1 757 | 1,128,88,39,110,36.5,1.057,37,1 758 | 7,137,90,41,0,32,0.391,39,0 759 | 0,123,72,0,0,36.3,0.258,52,1 760 | 1,106,76,0,0,37.5,0.197,26,0 761 | 6,190,92,0,0,35.5,0.278,66,1 762 | 2,88,58,26,16,28.4,0.766,22,0 763 | 9,170,74,31,0,44,0.403,43,1 764 | 9,89,62,0,0,22.5,0.142,33,0 765 | 10,101,76,48,180,32.9,0.171,63,0 766 | 2,122,70,27,0,36.8,0.34,27,0 767 | 5,121,72,23,112,26.2,0.245,30,0 768 | 1,126,60,0,0,30.1,0.349,47,1 769 | 1,93,70,31,0,30.4,0.315,23,0 770 | -------------------------------------------------------------------------------- /Chapter16/ch16_binning1.py: -------------------------------------------------------------------------------- 1 | #Binning with equal frequency 2 | def equal_frequency(array1, m): 3 | l = len(array1) 4 | n = int(l / m) 5 | for i in range(0, m): 6 | array = [] 7 | for j in range(i * n, (i + 1) * n): 8 | if j >= l: 9 | break 10 | array = array + [array1[j]] 11 | print(array) 12 | #Input dataset 13 | dataset = [3, 6, 7, 9, 11, 14, 10, 15, 19, 35, 38, 45, 48, 49, 76] 14 | #Input number of bins 15 | m = 5 16 | print("Equal Frequency Binning: ") 17 | equal_frequency(dataset, m) 18 | -------------------------------------------------------------------------------- /Chapter16/ch16_binning2.py: -------------------------------------------------------------------------------- 1 | #Binning with equal width 2 | def equal_width(array1, m): 3 | w = int((max(array1) - min(array1)) / m) 4 | min1 = min(array1) 5 | array = [] 6 | for i in range(0, m + 1): 7 | array = array + [min1 + w * i] 8 | arrayi=[] 9 | for i in range(0, m): 10 | result = [] 11 | for j in array1: 12 | if j >= array[i] and j <= array[i+1]: 13 | result += [j] 14 | arrayi += [result] 15 | print(arrayi) 16 | 17 | #Input dataset 18 | dataset = [3, 6, 7, 9, 11, 14, 10, 15, 19, 35, 38, 45, 48, 49, 76, 81, 208, 221] 19 | #Input number of bins 20 | m = 3 21 | 22 | print("\nEqual Width Binning:") 23 | equal_width(dataset, m) 24 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo1.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | myData = pd.read_csv('C:\\Users\\sofia.dejesus\\Documents\\02_book\\demo_missing.csv') 3 | print(myData) 4 | cleanData = myData.dropna(axis = 0, how = 'any') 5 | print(cleanData) 6 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | myData = pd.read_csv('C:\\...\\demo_missing.csv') 3 | print(pd.isna(myData['Countries'])) 4 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo3.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | myData = pd.read_csv('C:\\Users\\sofia.dejesus\\Documents\\02_book\\demo_missing.csv') 3 | print(myData.fillna(0)) 4 | 5 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo4.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | data = { 4 | 'Title': ['The Midnight Library', 'The Forever War', 'The Power', 5 | 'The Midnight Library', 'The Forever War', 'To Kill a Mockingbird'], 6 | 'Author': ['Matt Haig', 'Joe Haledeman', 'Naomi Alderman', 'Matt Haig', 7 | 'Joe Haledeman', 'Harper Lee'] 8 | } 9 | 10 | df = pd.DataFrame(data) 11 | 12 | print("Original Dataset:\n") 13 | 14 | print(df) 15 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo5.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | # ch16_cleaningDemo4.py 4 | data = { 5 | 'Title': ['The Midnight Library', 'The Forever War', 'The Power', 6 | 'The Midnight Library', 'The Forever War', 'To Kill a Mockingbird'], 7 | 'Author': ['Matt Haig', 'Joe Haledeman', 'Naomi Alderman', 'Matt Haig', 8 | 'Joe Haledeman', 'Harper Lee'] 9 | } 10 | df = pd.DataFrame(data) 11 | 12 | # Identify duplicates 13 | duplicates = df[df.duplicated()] 14 | print("\nDuplicates:\n") 15 | print(duplicates) 16 | 17 | # Remove duplicates 18 | df_cleaned = df.drop_duplicates() 19 | print("\nDataset after removing duplicates:\n") 20 | print(df_cleaned) 21 | -------------------------------------------------------------------------------- /Chapter16/ch16_cleaningDemo6.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | # Sample dataset 5 | data = { 6 | 'Name': ['Ed', 'Carina', 'Jeanie', 'Scott', 'John'], 7 | 'Height': [160, '5.9ft', 170.5, 'Unknown', '6ft'] 8 | } 9 | df = pd.DataFrame(data) 10 | print("Original DataFrame with Mixed Data types:") 11 | print(df) 12 | 13 | # Convert to a Consistent Format using a Function 14 | def convert_height(height): 15 | if 'ft' in str(height): 16 | return float(height.replace('ft', '')) * 30.48 17 | elif isinstance(height, (int, float)): 18 | return height 19 | else: 20 | return np.nan 21 | 22 | # Apply the Conversion Function 23 | df['Height'] = df['Height'].apply(convert_height) 24 | print("\nFixed Data Types:") 25 | print(df) 26 | 27 | # Handling Missing Values 28 | average_height = df['Height'].mean() 29 | df['Height'].fillna(average_height, inplace=True) 30 | print("\nFinalized Data Types:") 31 | print(df) 32 | -------------------------------------------------------------------------------- /Chapter16/ch16_csvDemo.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | data_set = pd.read_csv('C:\\...\\demo.csv') 4 | data_set.head() 5 | -------------------------------------------------------------------------------- /Chapter16/ch16_housePrice_prediction.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import pandas as pd 4 | import numpy as np 5 | import seaborn as sns 6 | import matplotlib.pyplot as plt 7 | 8 | housing_data= pd.read_csv("kc_house_data.csv") 9 | #Housing_data.head() 10 | #print(housing_data.shape) 11 | 12 | housing_data.describe(include=[np.number]) 13 | housing_data.head 14 | 15 | housing_data.describe() 16 | 17 | #Checking for missing values in data 18 | housing_data.isnull().sum() 19 | 20 | names=['price','bedrooms','bathrooms','sqft_living','sqft_lot','floors','waterfront','view','condition','grade','sqft_above','sqft_basement','zipcode','lat','long'] 21 | df=housing_data[names] 22 | correlations= df.corr() 23 | fig=plt.figure() 24 | ax=fig.add_subplot(111) 25 | cax=ax.matshow(correlations,vmin=-1,vmax=1) 26 | fig.colorbar(cax) 27 | ticks=np.arange(0,15,1) 28 | ax.set_xticks(ticks) 29 | ax.set_yticks(ticks) 30 | ax.set_xticklabels(names, rotation =' 90') 31 | ax.set_yticklabels(names) 32 | plt.tight_layout() 33 | plt.savefig('Correlation_graph.png',dpi = 300) 34 | plt.show() 35 | 36 | #Pairplotting for all data 37 | sns.pairplot(housing_data) 38 | plt.savefig('graphing.png',dpi =300) 39 | plt.show() 40 | #Pairplotting for some data 41 | coln = ['price','sqft_living','sqft_above'] 42 | sns.pairplot(housing_data[coln], size = 3); 43 | plt.savefig('pairplotting.png',dpi =300) 44 | plt.show() 45 | -------------------------------------------------------------------------------- /Chapter16/ch16_housePrice_prediction2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import pandas as pd 4 | import numpy as np 5 | import seaborn as sns 6 | import matplotlib.pyplot as plt 7 | 8 | 9 | housing_data= pd.read_csv("C:\\Users\\sofia.dejesus\\Documents\\02_book\\kc_house_data.csv") 10 | #Housing_data.head() 11 | #print(housing_data.shape) 12 | 13 | housing_data.describe(include=[np.number]) 14 | housing_data.head 15 | 16 | housing_data.describe() 17 | 18 | #Checking for missing values in data 19 | housing_data.isnull().sum() 20 | 21 | 22 | 23 | 24 | #Pairplotting for some data 25 | coln = ['price','sqft_living','zipcode', 'sqft_above'] 26 | sns.pairplot(housing_data[coln], height = 4); 27 | plt.savefig('pairplotting.png',dpi =300) 28 | plt.show() 29 | 30 | 31 | 32 | from plotnine.data import huron 33 | from plotnine import ggplot, aes, geom_boxplot 34 | 35 | (ggplot(huron) 36 | +aes(x = 'sqft_living', y='sqft_above') 37 | +geom_boxplot() 38 | ) 39 | -------------------------------------------------------------------------------- /Chapter16/ch16_seriesDemo.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | dataset = np.array(['yellow', 'green', 'blue', 'violet', 'red']) 5 | data_series = pd.Series(dataset) 6 | print(dataset) 7 | -------------------------------------------------------------------------------- /Chapter16/ch16_seriesDemo2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | myList = ['yellow', 'green', 'blue', 'violet', 'red'] 5 | data_series = pd.Series(myList) 6 | print(data_series) 7 | -------------------------------------------------------------------------------- /Chapter16/ch16_seriesDemo3.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | myDictionary = { 4 | 'Name' : 'Miguel', 5 | 'Number' : 42, 6 | 'Age' : 'unknown' 7 | } 8 | 9 | mySeries = pd.Series(myDictionary) 10 | print(mySeries) 11 | -------------------------------------------------------------------------------- /Chapter16/ch16_seriesDemo4.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | myDictionary = { 4 | 'Name' : 'Miguel', 5 | 'Number' : 42, 6 | 'Age' : 'unknown' 7 | } 8 | 9 | mySeries = pd.Series(myDictionary) 10 | print(mySeries[:2]) 11 | 12 | -------------------------------------------------------------------------------- /Chapter16/demo.csv: -------------------------------------------------------------------------------- 1 | Colors,Numbers,Cities,Countries 2 | Red,1,New York,United States 3 | Blue,2,Paris,France 4 | Yellow,3,London,Chile 5 | Green ,4,Prague,Brazil 6 | Orange,5,Chicago,Mexico 7 | Black,6,San Juan,Canada 8 | Pink,7,León,Japan 9 | Purple,8,Santiago,China 10 | Magenta,9,Caracas,Germany 11 | Cyan,10,Quebec,New Zealand 12 | -------------------------------------------------------------------------------- /Chapter16/demo_missing.csv: -------------------------------------------------------------------------------- 1 | Colors,Numbers,Cities,Countries 2 | Red,1,New York,United States 3 | Blue,2,Paris, 4 | Yellow,,London,Chile 5 | Green ,4,Prague,Brazil 6 | Orange,5,Chicago,Mexico 7 | Black,6,San Juan,Canada 8 | Pink,7,León,Japan 9 | Purple,8,Santiago,China 10 | Magenta,9,Caracas,Germany 11 | Cyan,10,Quebec,New Zealand 12 | -------------------------------------------------------------------------------- /Chapter17/ch17_MLK-IHaveADream.txt: -------------------------------------------------------------------------------- 1 | I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation. 2 | 3 | Five score years ago, a great American, in whose symbolic shadow we stand today, signed the Emancipation Proclamation. This momentous decree came as a great beacon light of hope to millions of Negro slaves who had been seared in the flames of withering injustice. It came as a joyous daybreak to end the long night of their captivity. 4 | 5 | But one hundred years later, the Negro still is not free. One hundred years later, the life of the Negro is still sadly crippled by the manacles of segregation and the chains of discrimination. One hundred years later, the Negro lives on a lonely island of poverty in the midst of a vast ocean of material prosperity. One hundred years later, the Negro is still languished in the corners of American society and finds himself an exile in his own land. And so we've come here today to dramatize a shameful condition. 6 | 7 | In a sense we've come to our nation's capital to cash a check. When the architects of our republic wrote the magnificent words of the Constitution and the Declaration of Independence, they were signing a promissory note to which every American was to fall heir. This note was a promise that all men, yes, black men as well as white men, would be guaranteed the "unalienable Rights" of "Life, Liberty and the pursuit of Happiness." It is obvious today that America has defaulted on this promissory note, insofar as her citizens of color are concerned. Instead of honoring this sacred obligation, America has given the Negro people a bad check, a check which has come back marked "insufficient funds." 8 | 9 | But we refuse to believe that the bank of justice is bankrupt. We refuse to believe that there are insufficient funds in the great vaults of opportunity of this nation. And so, we've come to cash this check, a check that will give us upon demand the riches of freedom and the security of justice. 10 | 11 | We have also come to this hallowed spot to remind America of the fierce urgency of Now. This is no time to engage in the luxury of cooling off or to take the tranquilizing drug of gradualism. Now is the time to make real the promises of democracy. Now is the time to rise from the dark and desolate valley of segregation to the sunlit path of racial justice. Now is the time to lift our nation from the quicksands of racial injustice to the solid rock of brotherhood. Now is the time to make justice a reality for all of God's children. 12 | 13 | It would be fatal for the nation to overlook the urgency of the moment. This sweltering summer of the Negro's legitimate discontent will not pass until there is an invigorating autumn of freedom and equality. Nineteen sixty-three is not an end, but a beginning. And those who hope that the Negro needed to blow off steam and will now be content will have a rude awakening if the nation returns to business as usual. And there will be neither rest nor tranquility in America until the Negro is granted his citizenship rights. The whirlwinds of revolt will continue to shake the foundations of our nation until the bright day of justice emerges. 14 | 15 | But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force. 16 | 17 | The marvelous new militancy which has engulfed the Negro community must not lead us to a distrust of all white people, for many of our white brothers, as evidenced by their presence here today, have come to realize that their destiny is tied up with our destiny. And they have come to realize that their freedom is inextricably bound to our freedom. 18 | 19 | We cannot walk alone. 20 | 21 | And as we walk, we must make the pledge that we shall always march ahead. 22 | 23 | We cannot turn back. 24 | 25 | There are those who are asking the devotees of civil rights, "When will you be satisfied?" We can never be satisfied as long as the Negro is the victim of the unspeakable horrors of police brutality. We can never be satisfied as long as our bodies, heavy with the fatigue of travel, cannot gain lodging in the motels of the highways and the hotels of the cities. **We cannot be satisfied as long as the negro's basic mobility is from a smaller ghetto to a larger one. We can never be satisfied as long as our children are stripped of their self-hood and robbed of their dignity by signs stating: "For Whites Only."** We cannot be satisfied as long as a Negro in Mississippi cannot vote and a Negro in New York believes he has nothing for which to vote. No, no, we are not satisfied, and we will not be satisfied until "justice rolls down like waters, and righteousness like a mighty stream."1 26 | 27 | 28 | 29 | I am not unmindful that some of you have come here out of great trials and tribulations. Some of you have come fresh from narrow jail cells. And some of you have come from areas where your quest -- quest for freedom left you battered by the storms of persecution and staggered by the winds of police brutality. You have been the veterans of creative suffering. Continue to work with the faith that unearned suffering is redemptive. Go back to Mississippi, go back to Alabama, go back to South Carolina, go back to Georgia, go back to Louisiana, go back to the slums and ghettos of our northern cities, knowing that somehow this situation can and will be changed. 30 | 31 | Let us not wallow in the valley of despair, I say to you today, my friends. 32 | 33 | And so even though we face the difficulties of today and tomorrow, I still have a dream. It is a dream deeply rooted in the American dream. 34 | 35 | I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident, that all men are created equal." 36 | 37 | I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood. 38 | 39 | I have a dream that one day even the state of Mississippi, a state sweltering with the heat of injustice, sweltering with the heat of oppression, will be transformed into an oasis of freedom and justice. 40 | 41 | I have a dream that my four little children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. 42 | 43 | I have a dream today! 44 | 45 | I have a dream that one day, down in Alabama, with its vicious racists, with its governor having his lips dripping with the words of "interposition" and "nullification" -- one day right there in Alabama little black boys and black girls will be able to join hands with little white boys and white girls as sisters and brothers. 46 | 47 | I have a dream today! 48 | 49 | I have a dream that one day every valley shall be exalted, and every hill and mountain shall be made low, the rough places will be made plain, and the crooked places will be made straight; "and the glory of the Lord shall be revealed and all flesh shall see it together."2 50 | 51 | This is our hope, and this is the faith that I go back to the South with. 52 | 53 | With this faith, we will be able to hew out of the mountain of despair a stone of hope. With this faith, we will be able to transform the jangling discords of our nation into a beautiful symphony of brotherhood. With this faith, we will be able to work together, to pray together, to struggle together, to go to jail together, to stand up for freedom together, knowing that we will be free one day. 54 | 55 | And this will be the day -- this will be the day when all of God's children will be able to sing with new meaning: 56 | 57 | My country 'tis of thee, sweet land of liberty, of thee I sing. Land where my fathers died, land of the Pilgrim's pride, From every mountainside, let freedom ring! 58 | 59 | And if America is to be a great nation, this must become true. 60 | 61 | And so let freedom ring from the prodigious hilltops of New Hampshire. 62 | 63 | Let freedom ring from the mighty mountains of New York. 64 | 65 | Let freedom ring from the heightening Alleghenies of Pennsylvania. 66 | 67 | Let freedom ring from the snow-capped Rockies of Colorado. 68 | 69 | Let freedom ring from the curvaceous slopes of California. 70 | 71 | But not only that: 72 | 73 | Let freedom ring from Stone Mountain of Georgia. 74 | 75 | Let freedom ring from Lookout Mountain of Tennessee. 76 | 77 | Let freedom ring from every hill and molehill of Mississippi. 78 | 79 | From every mountainside, let freedom ring. 80 | 81 | 82 | 83 | And when this happens, and when we allow freedom ring, when we let it ring from every village and every hamlet, from every state and every city, we will be able to speed up that day when all of God's children, black men and white men, Jews and Gentiles, Protestants and Catholics, will be able to join hands and sing in the words of the old Negro spiritual: 84 | 85 | Free at last! Free at last! 86 | 87 | Thank God Almighty, we are free at last!3 -------------------------------------------------------------------------------- /Chapter17/ch17_chatBot.py: -------------------------------------------------------------------------------- 1 | import nltk 2 | import json 3 | import pickle 4 | import numpy as np 5 | 6 | nltk.download('punkt') 7 | nltk.download('wordnet') 8 | from nltk.stem import WordNetLemmatizer 9 | lemmatizer = WordNetLemmatizer() 10 | 11 | from keras.models import Sequential 12 | from keras.optimizers import SGD 13 | from keras.layers import Activation, Dense, Dropout 14 | import random 15 | 16 | #Upload intents file and create our lists 17 | words=[] 18 | classes = [] 19 | doc = [] 20 | ignore_words = ['?', '!', ',', '.'] 21 | data_words = open(r'C:\...\intents.json').read() 22 | intents = json.loads(data_words) 23 | 24 | for intent in intents['intents']: 25 | for pattern in intent['patterns']: 26 | 27 | #Tokenize all the words (separate them) 28 | w = nltk.word_tokenize(pattern) 29 | words.extend(w) 30 | #Add all the words into doc 31 | doc.append((w, intent['tag'])) 32 | 33 | #Add the classes 34 | if intent['tag'] not in classes: 35 | classes.append(intent['tag']) 36 | print(doc) 37 | 38 | #lemmatization 39 | 40 | words = [lemmatizer.lemmatize(w.lower()) for w in words if w not in ignore_words] 41 | words = sorted(list(set(words))) 42 | 43 | 44 | classes = sorted(list(set(classes))) 45 | 46 | pickle.dump(words,open('words.pkl','wb')) 47 | pickle.dump(classes,open('classes.pkl','wb')) 48 | 49 | #Training 50 | training = [] 51 | output_empty = [0] * len(classes) 52 | for doc in doc: 53 | #Initialize bag of words 54 | bag = [] 55 | #Create list of words 56 | pattern_words = doc[0] 57 | #Word lemmatization 58 | pattern_words = [lemmatizer.lemmatize(word.lower()) for word in pattern_words] 59 | for w in words: 60 | bag.append(1) if w in pattern_words else bag.append(0) 61 | output_row = list(output_empty) 62 | output_row[classes.index(doc[1])] = 1 63 | 64 | training.append([bag, output_row]) 65 | #Create np array 66 | random.shuffle(training) 67 | training = np.array(training) 68 | #Create training and testing lists 69 | train_x = list(training[:,0]) 70 | train_y = list(training[:,1]) 71 | 72 | #Create the model 73 | model = Sequential() 74 | model.add(Dense(128, input_shape=(len(train_x[0]),), activation='relu')) 75 | model.add(Dropout(0.5)) 76 | model.add(Dense(64, activation='relu')) 77 | model.add(Dense(35, activation='relu')) 78 | model.add(Dense(len(train_y[0]), activation='softmax')) 79 | 80 | #Compile the model 81 | sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True) 82 | model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy']) 83 | 84 | #Save the model 85 | hist = model.fit(np.array(train_x), np.array(train_y), epochs=150, batch_size=10, verbose=1) 86 | model.save('Mychatbot_model.h5', hist) 87 | 88 | from keras.models import load_model 89 | model = load_model('Mychatbot_model.h5') 90 | import json 91 | import random 92 | intents = json.loads(open('intents.json').read()) 93 | words = pickle.load(open('words.pkl','rb')) 94 | classes = pickle.load(open('classes.pkl','rb')) 95 | 96 | #Define chatbot functions 97 | def clean_up_sentence(sentence): 98 | sentence_words = nltk.word_tokenize(sentence) 99 | sentence_words = [lemmatizer.lemmatize(word.lower()) for word in sentence_words] 100 | return sentence_words 101 | 102 | def bow(sentence, words, show_details=True): 103 | sentence_words = clean_up_sentence(sentence) 104 | bag = [0]*len(words) 105 | for s in sentence_words: 106 | for i,w in enumerate(words): 107 | if w == s: 108 | bag[i] = 1 109 | return(np.array(bag)) 110 | 111 | def predict_class(sentence, model): 112 | p = bow(sentence, words,show_details=False) 113 | res = model.predict(np.array([p]))[0] 114 | ERROR_THRESHOLD = 0.25 115 | results = [[i,r] for i,r in enumerate(res) if r>ERROR_THRESHOLD] 116 | results.sort(key=lambda x: x[1], reverse=True) 117 | return_list = [] 118 | for r in results: 119 | return_list.append({"intent": classes[r[0]], "probability": str(r[1])}) 120 | return return_list 121 | 122 | def getResponse(ints, intents_json): 123 | tag = ints[0]['intent'] 124 | list_of_intents = intents_json['intents'] 125 | for i in list_of_intents: 126 | if(i['tag']== tag): 127 | result = random.choice(i['responses']) 128 | break 129 | return result 130 | 131 | def chatbot_response(msg): 132 | ints = predict_class(msg, model) 133 | res = getResponse(ints, intents) 134 | return res 135 | 136 | import tkinter 137 | from tkinter import * 138 | 139 | def send(): 140 | msg = EntryBox.get("1.0",'end-1c').strip() 141 | EntryBox.delete("0.0",END) 142 | 143 | if msg != '': 144 | ChatLog.config(state=NORMAL) 145 | ChatLog.insert(END, "Me: " + msg + '\n\n') 146 | ChatLog.config(foreground="#3E4149", font=("Arial", 12 )) 147 | 148 | res = chatbot_response(msg) 149 | ChatLog.insert(END, "ChatBot: " + res + '\n\n') 150 | 151 | ChatLog.config(state=DISABLED) 152 | ChatLog.yview(END) 153 | 154 | 155 | base = Tk() 156 | base.title("Chat with Customer Service") 157 | base.geometry("400x500") 158 | base.resizable(width=FALSE, height=FALSE) 159 | 160 | #Create ChatBot window 161 | ChatLog = Text(base, bd=6, bg="white", height="8", width="70", font="Calibri") 162 | 163 | ChatLog.config(state=DISABLED) 164 | 165 | #Scrollbar 166 | scrollbar = Scrollbar(base, command=ChatLog.yview, cursor="arrow") 167 | 168 | #Create Send button 169 | SendButton = Button(base, font=("Calibri",12,'bold'), text="Send", width="15", height=5, 170 | bd=0, bg="pink", activebackground="light green",fg='black', 171 | command= send ) 172 | 173 | EntryBox = Text(base, bd=0, bg="white",width="29", height="5", font="Arial") 174 | 175 | scrollbar.place(x=376,y=6, height=386) 176 | ChatLog.place(x=6,y=6, height=386, width=370) 177 | EntryBox.place(x=128, y=401, height=90, width=265) 178 | SendButton.place(x=6, y=401, height=90) 179 | 180 | base.mainloop() 181 | -------------------------------------------------------------------------------- /Chapter17/ch17_cryptographyA.py: -------------------------------------------------------------------------------- 1 | LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ' 2 | LETTERS = LETTERS.lower() 3 | 4 | def encrypt(message, key): 5 | encryptedM = '' 6 | for letts in message: 7 | if letts in LETTERS: 8 | num = LETTERS.find(letts) 9 | num += key 10 | encryptedM += LETTERS[num] 11 | 12 | return encryptedM 13 | 14 | def decode(message, key): 15 | decodedM = '' 16 | for chars in message: 17 | if chars in LETTERS: 18 | num = LETTERS.find(chars) 19 | num -= key 20 | decodedM += LETTERS[num] 21 | 22 | return decodedM 23 | 24 | def main(): 25 | message = input('What message do you need to encrypt or decrypt? ') 26 | key = int(input('Enter the key, numbered 1-26: ')) 27 | choice = input('Do you want to encrypt or decode? Type E for encrypt or D for decode: ') 28 | 29 | if choice.lower().startswith('e'): 30 | print(encrypt(message, key)) 31 | else: 32 | print(decode(message, key)) 33 | 34 | if __name__ == '__main__': 35 | main() 36 | -------------------------------------------------------------------------------- /Chapter17/ch17_hashing.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | import hashlib 3 | 4 | def hash_pwd(password): 5 | salt = uuid.uuid4().hex 6 | return hashlib.sha1(salt.encode() + password.encode()).hexdigest() + ':' + salt 7 | 8 | def check_pwd(hashed_pwd, user_pwd): 9 | password, salt = hashed_pwd.split(':') 10 | return password == hashlib.sha1(salt.encode() + user_pwd.encode()).hexdigest() 11 | 12 | new_pwd = input('Enter new password: ') 13 | hashed_pwd = hash_pwd(new_pwd) 14 | print('Hashed password: ' + hashed_pwd) 15 | confirm_pwd = input('Confirm password: ') 16 | 17 | if check_pwd(hashed_pwd, confirm_pwd): 18 | print('Confirmed!') 19 | else: 20 | print('Please try again') 21 | -------------------------------------------------------------------------------- /Chapter17/ch17_historicalTextAnalysis.py: -------------------------------------------------------------------------------- 1 | import nltk 2 | from nltk.tokenize import sent_tokenize, word_tokenize 3 | text = 'Fellow-Countrymen: At this second appearing to take the oath of the Presidential office there is less occasion for an extended address than there was at the first. Then a statement somewhat in detail of a course to be pursued seemed fitting and proper. Now, at the expiration of four years, during which public declarations have been constantly called forth on every point and phase of the great contest which still absorbs the attention and engrosses the energies of the nation, little that is new could be presented. The progress of our arms, upon which all else chiefly depends, is as well known to the public as to myself, and it is, I trust, reasonably satisfactory and encouraging to all. With high hope for the future, no prediction in regard to it is ventured. On the occasion corresponding to this four years ago all thoughts were anxiously directed to an impending civil war. All dreaded it, all sought to avert it. While the inaugural address was being delivered from this place, devoted altogether to saving the Union without war, urgent agents were in the city seeking to destroy it without war—seeking to dissolve the Union and divide effects by negotiation. Both parties deprecated war, but one of them would make war rather than let the nation survive, and the other would accept war rather than let it perish, and the war came. One-eighth of the whole population were colored slaves, not distributed generally over the Union, but localized in the southern part of it. These slaves constituted a peculiar and powerful interest. All knew that this interest was somehow the cause of the war. To strengthen, perpetuate, and extend this interest was the object for which the insurgents would rend the Union even by war, while the Government claimed no right to do more than to restrict the territorial enlargement of it. Neither party expected for the war the magnitude or the duration which it has already attained. Neither anticipated that the cause of the conflict might cease with or even before the conflict itself should cease. Each looked for an easier triumph, and a result less fundamental and astounding. Both read the same Bible and pray to the same God, and each invokes His aid against the other. It may seem strange that any men should dare to ask a just God\’s assistance in wringing their bread from the sweat of other men\’s faces, but let us judge not, that we be not judged. The prayers of both could not be answered. That of neither has been answered fully. The Almighty has His own purposes. \“Woe unto the world because of offenses; for it must needs be that offenses come, but woe to that man by whom the offense cometh.\” If we shall suppose that American slavery is one of those offenses which, in the providence of God, must needs come, but which, having continued through His appointed time, He now wills to remove, and that He gives to both North and South this terrible war as the woe due to those by whom the offense came, shall we discern therein any departure from those divine attributes which the believers in a living God always ascribe to Him? Fondly do we hope, fervently do we pray, that this mighty scourge of war may speedily pass away. Yet, if God wills that it continue until all the wealth piled by the bondsman\’s two hundred and fifty years of unrequited toil shall be sunk, and until every drop of blood drawn with the lash shall be paid by another drawn with the sword, as was said three thousand years ago, so still it must be said \“the judgments of the Lord are true and righteous altogether.\” With malice toward none, with charity for all, with firmness in the right as God gives us to see the right, let us strive on to finish the work we are in, to bind up the nation\’s wounds, to care for him who shall have borne the battle and for his widow and his orphan, to do all which may achieve and cherish a just and lasting peace among ourselves and with all nations.' 4 | tokenized_word = word_tokenize(text) 5 | print(tokenized_word) 6 | 7 | from nltk.probability import FreqDist 8 | fdist = FreqDist(tokenized_word) 9 | print(fdist) 10 | fdist.most_common(2) 11 | 12 | import matplotlib.pyplot as plt 13 | fdist.plot(30, cumulative = False) 14 | plt.show() 15 | -------------------------------------------------------------------------------- /Chapter17/ch17_readability.py: -------------------------------------------------------------------------------- 1 | from readability import Readability 2 | 3 | text = open('C:\\...\\ch15_MLK-IHaveADream.txt') 4 | text_up = text.read() 5 | 6 | r = Readability(text_up) 7 | flesch_kincaidR = r.flesch_kincaid() 8 | 9 | 10 | print('The text has a grade '+ flesch_kincaidR.grade_level + ' readability level.') 11 | -------------------------------------------------------------------------------- /Chapter17/ch17_storyTime.py: -------------------------------------------------------------------------------- 1 | print('Help me write a story by answering some questions. ') 2 | name = input('What name would you like to be known by? ') 3 | location = input('What is your favorite city, real or imaginary? ') 4 | time = input('Is this happening in the morning or afternoon? ') 5 | color = input('What is your favorite color? ') 6 | town_spot = input('Are you going to the market, the library, or the park? ') 7 | pet = input('What kind of pet would you like as your companion? ') 8 | pet_name = input('What is your pet\'s name? ') 9 | 10 | print('There once was a citizen in the town of %s, whose name was %s. %s loved to hang \ 11 | with their trusty %s, %s.' % (location, name, name, pet, pet_name)) 12 | print('You could always see them strolling through the %s \ 13 | in the %s, wearing their favorite %s attire.' % (town_spot, time, color)) 14 | -------------------------------------------------------------------------------- /Chapter17/ch17_travel.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from ortools.constraint_solver import routing_enums_pb2 3 | from ortools.constraint_solver import pywrapcp 4 | #Create data model. 5 | def create_data_model(): 6 | data = {} 7 | data['distance_matrix'] = [ 8 | [0, 95, 192, 789, 462], 9 | [95, 0, 105, 759, 431], 10 | [192, 105, 0, 701, 374], 11 | [789, 759, 701, 0, 344], 12 | [462, 431, 374, 344, 0], 13 | ] 14 | data['num_vehicles'] = 1 15 | data['depot'] = 0 16 | return data 17 | #Provide solution as output - print to console 18 | def print_solution(manager, routing, solution): 19 | print('Objective: {} miles'.format(solution.ObjectiveValue())) 20 | index = routing.Start(0) 21 | plan_output = 'Route for vehicle 0:\n' 22 | route_distance = 0 23 | while not routing.IsEnd(index): 24 | plan_output += ' {} ->'.format(manager.IndexToNode(index)) 25 | previous_index = index 26 | index = solution.Value(routing.NextVar(index)) 27 | route_distance += routing.GetArcCostForVehicle(previous_index, index, 0) 28 | plan_output += ' {}\n'.format(manager.IndexToNode(index)) 29 | print(plan_output) 30 | plan_output += 'Route distance: {}miles\n'.format(route_distance) 31 | 32 | def main(): 33 | data = create_data_model() 34 | manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']), 35 | data['num_vehicles'], data['depot']) 36 | 37 | # Create Routing Model. 38 | routing = pywrapcp.RoutingModel(manager) 39 | 40 | def distance_callback(from_index, to_index): 41 | from_node = manager.IndexToNode(from_index) 42 | to_node = manager.IndexToNode(to_index) 43 | return data['distance_matrix'][from_node][to_node] 44 | 45 | transit_callback_index = routing.RegisterTransitCallback(distance_callback) 46 | 47 | routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index) 48 | 49 | search_parameters = pywrapcp.DefaultRoutingSearchParameters() 50 | search_parameters.first_solution_strategy = ( 51 | routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC) 52 | 53 | solution = routing.SolveWithParameters(search_parameters) 54 | 55 | if solution: 56 | print_solution(manager, routing, solution) 57 | 58 | if __name__ == '__main__': 59 | main() 60 | -------------------------------------------------------------------------------- /Chapter17/ch17_webscraping.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import time 3 | from bs4 import BeautifulSoup 4 | import logging 5 | 6 | # Define the URL to Scrape 7 | url = 'http://quotes.toscrape.com' 8 | 9 | # Make an HTTP Request 10 | response = requests.get(url) 11 | 12 | # Parse the HTML Content 13 | soup = BeautifulSoup(response.content, 'html.parser') 14 | 15 | # Locate Quote Containers 16 | quote_containers = soup.find_all('div', class_='quote') 17 | 18 | # Loop Through Containers and Extract Data 19 | for quote_container in quote_containers: 20 | quote = quote_container.find('span', class_='text').text 21 | author = quote_container.find('small', class_='author').text 22 | print(f"{quote} — {author}") 23 | -------------------------------------------------------------------------------- /Chapter17/intents.json: -------------------------------------------------------------------------------- 1 | {"intents": [ 2 | {"tag": "greeting", 3 | "patterns": ["Hi", "How are you", "Is anyone there?", "Hello", "Good day"], 4 | "responses": ["Hello, thanks for visiting", "Good to see you again", "Hi there, how can I help?"], 5 | "context_set": "" 6 | }, 7 | {"tag": "goodbye", 8 | "patterns": ["Bye", "See you later", "Goodbye"], 9 | "responses": ["See you later, thanks for visiting", "Have a nice day", "Bye! Come back again soon."] 10 | }, 11 | {"tag": "thanks", 12 | "patterns": ["Thanks", "Thank you", "That's helpful"], 13 | "responses": ["Happy to help!", "Any time!", "My pleasure"] 14 | }, 15 | {"tag": "hours", 16 | "patterns": ["What hours are you open?", "What are your hours?", "When are you open today?" ], 17 | "responses": ["We're open every day 8am-10pm. Is there anything else I can help you with?", "Our hours are 8am-10pm every day."] 18 | }, 19 | {"tag": "payments", 20 | "patterns": ["Do you take credit cards?", "Do you accept Mastercard?", "Are you cash only?" ], 21 | "responses": ["We accept both VISA and Mastercard ", "We accept most major credit cards"] 22 | }, 23 | {"tag": "opentoday", 24 | "patterns": ["Are you open today?", "When do you open today?", "What are your hours today?"], 25 | "responses": ["We're open every day from 8am-10pm", "Our hours are 8am-10pm every day"] 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /Chapter17/pudgy.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Applied-Computational-Thinking-with-Python-Second-Edition/b8399777f44ab8b2ea65e5c1e2a1be658f66f76a/Chapter17/pudgy.PNG -------------------------------------------------------------------------------- /Chapter18/Ch18_languageDetection.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import matplotlib.pyplot as plt 4 | from sklearn.model_selection import train_test_split 5 | from sklearn.pipeline import Pipeline 6 | from sklearn.naive_bayes import MultinomialNB 7 | from sklearn.feature_extraction.text import CountVectorizer 8 | from sklearn.metrics import confusion_matrix, classification_report 9 | 10 | # Load your dataset 11 | dataset_path = r'C:\\...\\\dataset.csv' 12 | df = pd.read_csv(dataset_path) 13 | X = df['Text'] 14 | y = df['language'] 15 | 16 | # Splitting the dataset into training and testing sets 17 | X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) 18 | 19 | # Create a pipeline 20 | pipeline = Pipeline([ 21 | ('vectorizer', CountVectorizer()), 22 | ('classifier', MultinomialNB()) 23 | ]) 24 | 25 | # Train the model 26 | pipeline.fit(X_train, y_train) 27 | 28 | # Predictions 29 | y_pred = pipeline.predict(X_test) 30 | 31 | # Evaluate the model 32 | print(classification_report(y_test, y_pred)) 33 | conf_mat = confusion_matrix(y_test, y_pred) 34 | 35 | # Plot confusion matrix 36 | plt.figure(figsize=(10,10)) 37 | plt.imshow(conf_mat, interpolation='nearest', cmap=plt.cm.Blues) 38 | plt.title('Confusion Matrix') 39 | plt.colorbar() 40 | tick_marks = np.arange(len(y.unique())) 41 | plt.xticks(tick_marks, y.unique(), rotation=45) 42 | plt.yticks(tick_marks, y.unique()) 43 | plt.tight_layout() 44 | plt.ylabel('True label') 45 | plt.xlabel('Predicted label') 46 | plt.show() 47 | 48 | -------------------------------------------------------------------------------- /Chapter18/Data_Cortex_Nuclear.csv: -------------------------------------------------------------------------------- 1 | MouseID,DYRK1A_N,ITSN1_N,BDNF_N,NR1_N,NR2A_N,pAKT_N,Genotype,Treatment,Behavior,class 2 | 3414_1,0.838053341,1.006323893,0.3649528,2.603061131,4.207680323,0.202547887,Ts65Dn,Memantine,C/S,t-CS-m 3 | 3414_2,0.938244544,1.077099018,0.366148861,2.703611932,4.48422758,0.197464977,Ts65Dn,Memantine,C/S,t-CS-m 4 | 3414_3,0.956488032,1.10844074,0.384048842,2.662564202,4.606357205,0.203798818,Ts65Dn,Memantine,C/S,t-CS-m 5 | 3414_4,0.731738035,0.944240898,0.324364552,2.32024273,3.621250286,0.198648958,Ts65Dn,Memantine,C/S,t-CS-m 6 | 3414_5,0.815502959,1.00556213,0.335976331,2.379289941,3.641656805,0.217869822,Ts65Dn,Memantine,C/S,t-CS-m 7 | 3414_6,0.807474652,0.925253478,0.334826692,2.327988682,4.018038199,0.206437161,Ts65Dn,Memantine,C/S,t-CS-m 8 | 3414_7,0.668977725,0.903673108,0.312435462,2.291340906,3.594777991,0.207110193,Ts65Dn,Memantine,C/S,t-CS-m 9 | 3414_8,0.776663065,0.916962494,0.327056645,2.407933323,3.627102948,0.209445902,Ts65Dn,Memantine,C/S,t-CS-m 10 | 3414_9,0.646086165,0.942657767,0.313106796,2.259708738,3.694629854,0.217536408,Ts65Dn,Memantine,C/S,t-CS-m 11 | 3414_10,0.602819996,0.835561253,0.301043765,2.133125801,3.064457059,0.215345175,Ts65Dn,Memantine,C/S,t-CS-m 12 | 3414_11,0.625976005,0.806893925,0.327937536,2.217863264,3.52161493,0.236526376,Ts65Dn,Memantine,C/S,t-CS-m 13 | 3414_12,0.605380298,0.875749952,0.312754016,2.184633249,3.676795045,0.225275789,Ts65Dn,Memantine,C/S,t-CS-m 14 | 3414_13,0.555122374,0.726229153,0.278319255,2.097249296,2.897552523,0.222222222,Ts65Dn,Memantine,C/S,t-CS-m 15 | 3414_14,0.543225534,0.757767914,0.294018178,2.014161911,3.134432467,0.211794547,Ts65Dn,Memantine,C/S,t-CS-m 16 | 3414_15,0.574554817,0.714868054,0.278910105,2.026818279,3.281270114,0.200815276,Ts65Dn,Memantine,C/S,t-CS-m 17 | 3416_1,0.641871921,0.8591133,0.327980296,2.652610837,4.201576355,0.190246305,Ts65Dn,Memantine,C/S,t-CS-m 18 | 3416_2,0.673084718,0.877280097,0.341102554,2.696291042,4.180077017,0.194568302,Ts65Dn,Memantine,C/S,t-CS-m 19 | 3416_3,0.660194175,0.828580097,0.341929612,2.662216828,4.58131068,0.198624595,Ts65Dn,Memantine,C/S,t-CS-m 20 | 3416_4,0.571500251,0.747992975,0.311465128,2.450200702,3.827270447,0.200075263,Ts65Dn,Memantine,C/S,t-CS-m 21 | 3416_5,0.540852001,0.738702577,0.318658552,2.47921792,4.044930726,0.203418361,Ts65Dn,Memantine,C/S,t-CS-m 22 | 3416_6,0.649590164,0.728995902,0.316854508,2.486296107,3.866675205,0.200947746,Ts65Dn,Memantine,C/S,t-CS-m 23 | 3416_7,0.474654378,0.671428571,0.294930876,2.251920123,3.322580645,0.204454685,Ts65Dn,Memantine,C/S,t-CS-m 24 | 3416_8,0.46444276,0.66899166,0.290523124,2.188476118,3.500682335,0.20318423,Ts65Dn,Memantine,C/S,t-CS-m 25 | 3416_9,0.542598762,0.673647469,0.307472632,2.346501666,3.6127241,0.211962558,Ts65Dn,Memantine,C/S,t-CS-m 26 | 3416_10,0.418401057,0.53534853,0.279319458,1.909811695,2.686653452,0.190452593,Ts65Dn,Memantine,C/S,t-CS-m 27 | 3416_11,0.406919537,0.520234883,0.249166799,1.799555626,2.358673226,0.176956039,Ts65Dn,Memantine,C/S,t-CS-m 28 | 3416_12,0.44573509,0.584778086,0.268377254,1.993758669,2.746879334,0.199202497,Ts65Dn,Memantine,C/S,t-CS-m 29 | 3416_13,0.511217949,0.65728022,0.322344322,2.196657509,3.155677656,0.243589744,Ts65Dn,Memantine,C/S,t-CS-m 30 | 3416_14,0.392627058,0.503042233,0.251431639,1.726020043,2.377594846,0.187902649,Ts65Dn,Memantine,C/S,t-CS-m 31 | 3416_15,0.440879382,0.539512775,0.263418499,1.89681125,2.458902753,0.208358091,Ts65Dn,Memantine,C/S,t-CS-m 32 | 3417_1,0.449649843,0.648031876,0.261531031,1.789181357,2.991789423,0.181960879,Ts65Dn,Memantine,C/S,t-CS-m 33 | 3417_2,0.486866675,0.681812523,0.250591311,1.835926802,3.239014067,0.18175028,Ts65Dn,Memantine,C/S,t-CS-m 34 | 3417_3,0.52421875,0.700130208,0.257682292,1.954036458,3.281380208,0.194921875,Ts65Dn,Memantine,C/S,t-CS-m 35 | 3417_4,0.427303466,0.579740772,0.233023387,1.637080868,2.612426036,0.184981685,Ts65Dn,Memantine,C/S,t-CS-m 36 | 3417_5,0.434017595,0.563343109,0.241055718,1.720234604,2.727859238,0.187096774,Ts65Dn,Memantine,C/S,t-CS-m 37 | 3417_6,0.467165809,0.6284511,0.255966308,1.785680861,2.848697551,0.198253003,Ts65Dn,Memantine,C/S,t-CS-m 38 | 3417_7,0.369484046,0.485913103,0.228784793,1.441955193,2.103699932,0.184317719,Ts65Dn,Memantine,C/S,t-CS-m 39 | 3417_8,0.403018446,0.530091299,0.23737656,1.603316564,2.509409353,0.197503261,Ts65Dn,Memantine,C/S,t-CS-m 40 | 3417_9,0.408687259,0.56988417,0.243436293,1.633783784,2.580888031,0.20965251,Ts65Dn,Memantine,C/S,t-CS-m 41 | 3417_10,0.413551913,0.502295082,0.231256831,1.499453552,2.086338798,0.208743169,Ts65Dn,Memantine,C/S,t-CS-m 42 | 3417_11,0.418160377,0.523820755,0.251415094,1.564858491,2.319575472,0.224764151,Ts65Dn,Memantine,C/S,t-CS-m 43 | 3417_12,0.407619048,0.540952381,0.255,1.603571429,2.356666667,0.246190476,Ts65Dn,Memantine,C/S,t-CS-m 44 | 3417_13,0.358104609,0.463231486,0.29337131,1.465820818,2.039875712,0.210253755,Ts65Dn,Memantine,C/S,t-CS-m 45 | 3417_14,0.377394636,0.486590038,0.253147236,1.554734537,2.141215107,0.223864258,Ts65Dn,Memantine,C/S,t-CS-m 46 | 3417_15,0.495831017,0.5,0.290439133,1.569483046,2.217342968,0.229294052,Ts65Dn,Memantine,C/S,t-CS-m 47 | 3429_1,0.853105838,1.071847507,0.280458544,2.080645161,3.850306585,0.181284991,Ts65Dn,Memantine,C/S,t-CS-m 48 | 3429_2,0.872787758,0.980172987,0.274916833,2.052561544,3.808915502,0.183499667,Ts65Dn,Memantine,C/S,t-CS-m 49 | 3429_3,0.88856383,1.071409574,0.29375,2.045478723,3.782978723,0.175132979,Ts65Dn,Memantine,C/S,t-CS-m 50 | 3429_4,0.765429988,0.92648316,0.264489656,1.943580099,3.380406907,0.186014703,Ts65Dn,Memantine,C/S,t-CS-m 51 | 3429_5,0.799383245,0.889155388,0.259551139,1.938667124,3.418022957,0.188281652,Ts65Dn,Memantine,C/S,t-CS-m 52 | 3429_6,0.712608987,0.908283032,0.253353454,1.922367539,3.242622401,0.184942991,Ts65Dn,Memantine,C/S,t-CS-m 53 | 3429_7,0.629769299,0.741792369,0.235359361,1.795031056,2.77284827,0.187888199,Ts65Dn,Memantine,C/S,t-CS-m 54 | 3429_8,0.682577566,0.73117813,0.240833153,1.719027989,2.654154914,0.188327186,Ts65Dn,Memantine,C/S,t-CS-m 55 | 3429_9,0.697576162,0.737825217,0.25594841,1.755392484,2.729597509,0.203468979,Ts65Dn,Memantine,C/S,t-CS-m 56 | 3429_10,0.6327057,0.677585762,0.29687903,1.696672685,2.573123549,0.193964405,Ts65Dn,Memantine,C/S,t-CS-m 57 | 3429_11,0.62566709,0.686404066,0.240914867,1.688691233,2.503684879,0.192121982,Ts65Dn,Memantine,C/S,t-CS-m 58 | 3429_12,0.590007726,0.765130054,0.241050734,1.711820757,2.582024208,0.219675509,Ts65Dn,Memantine,C/S,t-CS-m 59 | 3429_13,0.489164087,0.644807205,0.275541796,1.520123839,2.213340839,0.181255277,Ts65Dn,Memantine,C/S,t-CS-m 60 | 3429_14,0.538779121,0.627248599,0.23562371,1.572692421,2.252727809,0.189029785,Ts65Dn,Memantine,C/S,t-CS-m 61 | 3429_15,0.5085554,0.614586255,0.227769986,1.509677419,2.204207574,0.178681627,Ts65Dn,Memantine,C/S,t-CS-m 62 | 3504_1,0.992220227,1.151506084,0.319868342,2.485338121,4.102832635,0.178635548,Ts65Dn,Memantine,C/S,t-CS-m 63 | 3504_2,0.928896811,1.061695385,0.311150723,2.448900772,4.001485443,0.175282234,Ts65Dn,Memantine,C/S,t-CS-m 64 | 3504_3,0.957687153,1.097645032,0.323281639,2.424851618,3.816101857,0.174516561,Ts65Dn,Memantine,C/S,t-CS-m 65 | 3504_4,0.887376701,0.972655762,0.301410913,2.263953053,3.646148083,0.18441753,Ts65Dn,Memantine,C/S,t-CS-m 66 | 3504_5,0.713779191,1.007702653,0.286098545,2.239515833,3.423279129,0.17850593,Ts65Dn,Memantine,C/S,t-CS-m 67 | 3504_6,0.836870831,0.988841722,0.279078229,2.242328684,3.285506367,0.174408733,Ts65Dn,Memantine,C/S,t-CS-m 68 | 3504_7,0.750715512,0.934029765,0.274184316,2.114195764,3.283485976,0.178162564,Ts65Dn,Memantine,C/S,t-CS-m 69 | 3504_8,0.743111606,0.905093237,0.264681325,2.078207626,3.014472586,0.1703312,Ts65Dn,Memantine,C/S,t-CS-m 70 | 3504_9,0.702003878,0.845378151,0.26981254,1.962249515,2.83956044,0.175048481,Ts65Dn,Memantine,C/S,t-CS-m 71 | 3504_10,0.676784249,0.743724364,0.303199344,1.985233798,2.945365053,0.179163249,Ts65Dn,Memantine,C/S,t-CS-m 72 | 3504_11,0.620656525,0.850280224,0.248358687,1.944435548,2.798398719,0.169095276,Ts65Dn,Memantine,C/S,t-CS-m 73 | 3504_12,0.657391048,0.730418139,0.261925795,1.850853946,2.544169611,0.15753828,Ts65Dn,Memantine,C/S,t-CS-m 74 | 3504_13,0.647732002,0.677070329,0.24968789,1.687265918,2.325634623,0.181856013,Ts65Dn,Memantine,C/S,t-CS-m 75 | 3504_14,0.567562267,0.702098451,0.232790743,1.616395372,2.150813885,0.15807021,Ts65Dn,Memantine,C/S,t-CS-m 76 | 3504_15,0.490716673,0.592461938,0.213702191,1.540846639,2.053286298,0.152432232,Ts65Dn,Memantine,C/S,t-CS-m 77 | 3505_1,0.917992093,1.336397904,0.466672796,3.100855015,5.783028409,0.220649076,Ts65Dn,Memantine,C/S,t-CS-m 78 | 3505_2,0.945885309,1.29875258,0.445840438,2.937987975,5.585748901,0.216010051,Ts65Dn,Memantine,C/S,t-CS-m 79 | 3505_3,0.945123015,1.200488571,0.432995987,2.870615948,5.406735299,0.213226313,Ts65Dn,Memantine,C/S,t-CS-m 80 | 3505_4,0.814390744,1.124141256,0.388574183,2.632156201,4.972038086,0.233939978,Ts65Dn,Memantine,C/S,t-CS-m 81 | 3505_5,0.796207393,1.052328373,0.381541047,2.596735478,4.652184349,0.230676908,Ts65Dn,Memantine,C/S,t-CS-m 82 | 3505_6,0.861265523,1.039503253,0.378001183,2.55836783,4.57125961,0.22613838,Ts65Dn,Memantine,C/S,t-CS-m 83 | 3505_7,0.808938878,1.042622466,0.376350451,2.54417641,4.725765872,0.247003108,Ts65Dn,Memantine,C/S,t-CS-m 84 | 3505_8,0.784335982,0.900113507,0.36123723,2.42068672,4.383087401,0.239784336,Ts65Dn,Memantine,C/S,t-CS-m 85 | 3505_9,0.646110057,0.936297099,0.348197343,2.378422337,3.972756845,0.223502304,Ts65Dn,Memantine,C/S,t-CS-m 86 | 3505_10,0.623297241,0.885260217,0.32745372,2.281348236,4.094306671,0.227383863,Ts65Dn,Memantine,C/S,t-CS-m 87 | 3505_11,0.718597506,0.85938912,0.332911621,2.332730887,3.814386409,0.249051148,Ts65Dn,Memantine,C/S,t-CS-m 88 | 3505_12,0.613746857,0.840737636,0.314333613,2.194300084,3.499413244,0.229505448,Ts65Dn,Memantine,C/S,t-CS-m 89 | 3505_13,0.64516129,0.856832186,0.326748822,2.187205509,3.7232693,0.227981153,Ts65Dn,Memantine,C/S,t-CS-m 90 | 3505_14,0.599744944,0.805064675,0.321734378,2.179449809,3.793769357,0.238841319,Ts65Dn,Memantine,C/S,t-CS-m 91 | 3505_15,0.619073084,0.840106952,0.318716578,2.132620321,3.704456328,0.232442068,Ts65Dn,Memantine,C/S,t-CS-m 92 | 3522_1,0.713212025,1.077531646,0.415446994,3.046875,5.546973892,0.218651108,Ts65Dn,Memantine,C/S,t-CS-m 93 | 3522_2,0.751167,1.043822044,0.390778318,2.868248071,5.130132419,0.214537487,Ts65Dn,Memantine,C/S,t-CS-m 94 | 3522_3,0.758857798,1.053672047,0.38410849,2.867443415,5.053385541,0.216693726,Ts65Dn,Memantine,C/S,t-CS-m 95 | 3522_4,0.551741294,0.772761194,0.344278607,2.437810945,4.533457711,0.212686567,Ts65Dn,Memantine,C/S,t-CS-m 96 | 3522_5,0.612544759,0.848252871,0.342264477,2.359797506,3.996295839,0.215211755,Ts65Dn,Memantine,C/S,t-CS-m 97 | 3522_6,0.57797946,0.838309052,0.324337234,2.321112969,4.141748268,0.20277048,Ts65Dn,Memantine,C/S,t-CS-m 98 | 3522_7,0.595567867,0.790785829,0.319142732,2.243913107,4.154104097,0.213296399,Ts65Dn,Memantine,C/S,t-CS-m 99 | 3522_8,0.513900956,0.807413843,0.309006661,2.232551405,3.817694758,0.216623226,Ts65Dn,Memantine,C/S,t-CS-m 100 | 3522_9,0.569611503,0.71312042,0.294898382,2.132863266,3.787086963,0.200331813,Ts65Dn,Memantine,C/S,t-CS-m 101 | 3522_10,0.578980623,0.722620051,0.330665543,2.375105307,4.209351306,0.27274642,Ts65Dn,Memantine,C/S,t-CS-m 102 | 3522_11,0.555489614,0.713155292,0.317111771,2.150939664,3.629673591,0.255192878,Ts65Dn,Memantine,C/S,t-CS-m 103 | 3522_12,0.526943726,0.679459137,0.322330483,2.194273215,3.738914297,0.231059853,Ts65Dn,Memantine,C/S,t-CS-m 104 | 3522_13,0.570857286,0.717570607,0.326418395,2.269182704,3.827043239,0.274931267,Ts65Dn,Memantine,C/S,t-CS-m 105 | 3522_14,0.483457124,0.636506865,0.290119289,2.019131218,3.21156876,0.236776953,Ts65Dn,Memantine,C/S,t-CS-m 106 | 3522_15,0.481111903,0.665478736,0.360893324,2.097172725,3.537894987,0.245664053,Ts65Dn,Memantine,C/S,t-CS-m 107 | 361_1,0.525159667,0.786626669,0.41784401,2.947164699,5.365686085,0.215211922,Ts65Dn,Memantine,C/S,t-CS-m 108 | 361_2,0.515455875,0.754168698,0.418137494,2.96050707,5.337298879,0.213066797,Ts65Dn,Memantine,C/S,t-CS-m 109 | 361_3,0.51733308,0.742805585,0.414949188,2.887263748,5.376958875,0.218159369,Ts65Dn,Memantine,C/S,t-CS-m 110 | 361_4,0.464629817,0.66658215,0.377915822,2.701698783,4.782074037,0.234533469,Ts65Dn,Memantine,C/S,t-CS-m 111 | 361_5,0.466666667,0.68984375,0.390885417,2.6703125,5.059375,0.238802083,Ts65Dn,Memantine,C/S,t-CS-m 112 | 361_6,0.481457385,0.680676643,0.387638256,2.757709824,5.200910865,0.240728692,Ts65Dn,Memantine,C/S,t-CS-m 113 | 361_7,0.416061925,0.598451863,0.344299307,2.4771811,4.595549105,0.239638768,Ts65Dn,Memantine,C/S,t-CS-m 114 | 361_8,0.426573427,0.606440072,0.351439258,2.526914946,4.521710847,0.246056269,Ts65Dn,Memantine,C/S,t-CS-m 115 | 361_9,0.430107527,0.598197343,0.345825427,2.478810879,4.509803922,0.238614801,Ts65Dn,Memantine,C/S,t-CS-m 116 | 361_10,0.412220961,0.575482406,0.335981839,2.225879682,3.667990919,0.231176693,Ts65Dn,Memantine,C/S,t-CS-m 117 | 361_11,0.397928437,0.553483992,0.331450094,2.256685499,3.959698682,0.248399247,Ts65Dn,Memantine,C/S,t-CS-m 118 | 361_12,0.417036038,0.584891116,0.365002891,2.30815186,4.015609944,0.243592214,Ts65Dn,Memantine,C/S,t-CS-m 119 | 361_13,0.492463442,0.556805399,0.324859393,2.165129359,3.456692913,0.24791901,Ts65Dn,Memantine,C/S,t-CS-m 120 | 361_14,0.423413063,0.556117755,0.331876725,2.213431463,3.556577737,0.249080037,Ts65Dn,Memantine,C/S,t-CS-m 121 | 361_15,0.406686512,0.583008931,0.329745821,2.245019464,3.491183879,0.257384932,Ts65Dn,Memantine,C/S,t-CS-m 122 | 363_1,0.787210825,1.085552161,0.34209952,2.626909646,4.110323003,0.217154081,Ts65Dn,Memantine,C/S,t-CS-m 123 | 363_2,0.862424764,1.071259673,0.342218401,2.545786758,4.052880482,0.227858985,Ts65Dn,Memantine,C/S,t-CS-m 124 | 363_3,0.774383592,1.046803404,0.353698451,2.586188086,4.151429195,0.222779839,Ts65Dn,Memantine,C/S,t-CS-m 125 | 363_4,0.687778897,0.942133295,0.311645315,2.287030373,3.606880668,0.223693681,Ts65Dn,Memantine,C/S,t-CS-m 126 | 363_5,0.666568135,0.95876441,0.325450783,2.364912799,3.572716524,0.228495418,Ts65Dn,Memantine,C/S,t-CS-m 127 | 363_6,0.694370722,0.918983098,0.310937282,2.292778321,3.506076268,0.259533454,Ts65Dn,Memantine,C/S,t-CS-m 128 | 363_7,0.715018037,0.925954054,0.338902601,2.373457376,3.55686349,0.250806911,Ts65Dn,Memantine,C/S,t-CS-m 129 | 363_8,0.667406996,0.865630205,0.330186933,2.359429946,3.470664446,0.241532482,Ts65Dn,Memantine,C/S,t-CS-m 130 | 363_9,0.643166246,0.907500902,0.315903354,2.317526145,3.415073927,0.239271547,Ts65Dn,Memantine,C/S,t-CS-m 131 | 363_10,0.629817678,0.807523656,0.321024694,2.15531964,3.016385876,0.273713363,Ts65Dn,Memantine,C/S,t-CS-m 132 | 363_11,0.600938967,0.837323944,0.359624413,2.194366197,3.124178404,0.245305164,Ts65Dn,Memantine,C/S,t-CS-m 133 | 363_12,0.65051081,0.800665241,0.328581611,2.291518175,3.08030411,0.263958185,Ts65Dn,Memantine,C/S,t-CS-m 134 | 363_13,0.616950098,0.763590744,0.350989685,2.120713688,2.682743239,0.274881517,Ts65Dn,Memantine,C/S,t-CS-m 135 | 363_14,0.590333717,0.791139241,0.331990794,2.174913694,3.023878021,0.28164557,Ts65Dn,Memantine,C/S,t-CS-m 136 | 363_15,0.621177149,0.819965378,0.354010387,2.194171956,2.889786497,0.271206001,Ts65Dn,Memantine,C/S,t-CS-m 137 | 18899_1,0.506199732,0.696045576,0.316018767,2.204591153,4.154323056,0.254859249,Ts65Dn,Saline,C/S,t-CS-s 138 | 18899_2,0.523760331,0.746212121,0.324896694,2.285640496,4.32231405,0.268767218,Ts65Dn,Saline,C/S,t-CS-s 139 | 18899_3,0.51861167,0.73323273,0.356136821,2.330147552,4.631455399,0.272468142,Ts65Dn,Saline,C/S,t-CS-s 140 | 18899_4,0.436986301,0.626614481,0.295107632,2.008023483,3.605088063,0.258317025,Ts65Dn,Saline,C/S,t-CS-s 141 | 18899_5,0.505599336,0.719825798,0.314599751,2.194110328,3.908544173,0.281833264,Ts65Dn,Saline,C/S,t-CS-s 142 | 18899_6,0.474593292,0.702149026,0.326169914,2.174733882,3.998393252,0.276762402,Ts65Dn,Saline,C/S,t-CS-s 143 | 18899_7,0.395155545,0.561861791,0.270482071,1.912609831,3.281168369,0.269057231,Ts65Dn,Saline,C/S,t-CS-s 144 | 18899_8,0.404483431,0.591861598,0.26754386,2.019249513,3.473196881,0.276803119,Ts65Dn,Saline,C/S,t-CS-s 145 | 18899_9,0.40806529,0.607777244,0.308209313,2.096975516,3.567930869,0.293807009,Ts65Dn,Saline,C/S,t-CS-s 146 | 18899_10,0.367553866,0.519011407,0.267427123,1.878010139,2.773764259,0.275665399,Ts65Dn,Saline,C/S,t-CS-s 147 | 18899_11,0.368455285,0.550894309,0.276097561,1.929105691,2.89300813,0.28097561,Ts65Dn,Saline,C/S,t-CS-s 148 | 18899_12,0.376694642,0.534215623,0.29535184,1.996772111,2.990961911,0.28663654,Ts65Dn,Saline,C/S,t-CS-s 149 | 18899_13,0.381559767,0.547740525,0.292274052,1.909620991,2.709912536,0.30648688,Ts65Dn,Saline,C/S,t-CS-s 150 | 18899_14,0.391991183,0.555106539,0.286921381,1.939382807,2.814474651,0.324761205,Ts65Dn,Saline,C/S,t-CS-s 151 | 18899_15,0.366010733,0.574955277,0.290876565,1.921288014,2.798926655,0.3019678,Ts65Dn,Saline,C/S,t-CS-s 152 | 3476_1,0.526969902,0.868870477,0.352553263,2.693523842,4.075160636,0.239093676,Ts65Dn,Saline,C/S,t-CS-s 153 | 3476_2,0.55318967,0.857961348,0.347528647,2.630494271,4.125534462,0.224132034,Ts65Dn,Saline,C/S,t-CS-s 154 | 3476_3,0.544262295,0.902791316,0.370934869,2.642268498,4.5590607,0.253079309,Ts65Dn,Saline,C/S,t-CS-s 155 | 3476_4,0.425799746,0.704007391,0.300496593,2.129922624,3.277630211,0.228663818,Ts65Dn,Saline,C/S,t-CS-s 156 | 3476_5,0.442892358,0.732010799,0.29487029,2.133348985,3.324568611,0.224674258,Ts65Dn,Saline,C/S,t-CS-s 157 | 3476_6,0.457482585,0.728561134,0.304107615,2.213547922,3.558131155,0.234085996,Ts65Dn,Saline,C/S,t-CS-s 158 | 3476_7,0.438651138,0.710455038,0.291847237,2.15804442,3.184588299,0.257990249,Ts65Dn,Saline,C/S,t-CS-s 159 | 3476_8,0.426918308,0.700785232,0.302107728,2.180741149,3.463837994,0.259953162,Ts65Dn,Saline,C/S,t-CS-s 160 | 3476_9,0.617111731,0.68779062,0.292148266,2.113192507,3.393250963,0.237013418,Ts65Dn,Saline,C/S,t-CS-s 161 | 3476_10,0.385826772,0.593951324,0.332319256,2.110415175,2.957945598,0.252505369,Ts65Dn,Saline,C/S,t-CS-s 162 | 3476_11,0.362542647,0.615191237,0.301669959,2.063386604,2.841443706,0.253905549,Ts65Dn,Saline,C/S,t-CS-s 163 | 3476_12,0.324104235,0.552117264,0.288273616,1.905863192,2.654723127,0.228338762,Ts65Dn,Saline,C/S,t-CS-s 164 | 3476_13,0.442971339,0.564827452,0.282316241,1.932930396,2.564047573,0.243127315,Ts65Dn,Saline,C/S,t-CS-s 165 | 3476_14,0.427474747,0.609090909,0.284848485,2.009090909,2.598989899,0.246666667,Ts65Dn,Saline,C/S,t-CS-s 166 | 3476_15,0.392589889,0.521628034,0.289833911,1.792297865,2.359737178,0.218288009,Ts65Dn,Saline,C/S,t-CS-s 167 | 3483_1,0.523507564,0.860404022,0.355557569,2.433010236,4.030709303,0.185886403,Ts65Dn,Saline,C/S,t-CS-s 168 | 3483_2,0.522842189,0.852922913,0.337886987,2.343386854,4.015523818,0.181850439,Ts65Dn,Saline,C/S,t-CS-s 169 | 3483_3,0.528320141,0.836851363,0.346877748,2.456112577,3.918997361,0.179331574,Ts65Dn,Saline,C/S,t-CS-s 170 | 3483_4,0.444394162,0.710940152,0.294829732,2.068672927,3.228306369,0.176829958,Ts65Dn,Saline,C/S,t-CS-s 171 | 3483_5,0.435862227,0.71873212,0.288591372,2.035587596,3.275431972,0.178052409,Ts65Dn,Saline,C/S,t-CS-s 172 | 3483_6,0.447674419,0.709883721,0.294651163,2.076860465,3.398023256,0.181162791,Ts65Dn,Saline,C/S,t-CS-s 173 | 3483_7,0.435215054,0.680107527,0.285349462,1.979973118,3.070295699,0.175,Ts65Dn,Saline,C/S,t-CS-s 174 | 3483_8,0.416655634,0.655633523,0.271282934,1.969416126,3.038262942,0.173573415,Ts65Dn,Saline,C/S,t-CS-s 175 | 3483_9,0.432090456,0.685960425,0.279176201,1.99380805,3.123973617,0.180643424,Ts65Dn,Saline,C/S,t-CS-s 176 | 3483_10,0.423789174,0.591702279,0.25462963,1.83048433,2.650106838,0.183582621,Ts65Dn,Saline,C/S,t-CS-s 177 | 3483_11,0.387130988,0.569383065,0.259678275,1.815273113,2.642036415,0.184019798,Ts65Dn,Saline,C/S,t-CS-s 178 | 3483_12,0.375280899,0.584961106,0.247709594,1.780466724,2.591702679,0.17355229,Ts65Dn,Saline,C/S,t-CS-s 179 | 3483_13,0.439808345,0.604711519,0.24376123,1.793970852,2.506687962,0.178279098,Ts65Dn,Saline,C/S,t-CS-s 180 | 3483_14,0.425365854,0.587121951,0.24195122,1.740878049,2.48897561,0.173073171,Ts65Dn,Saline,C/S,t-CS-s 181 | 3483_15,0.38538206,0.590775845,0.239984366,1.739886652,2.510455345,0.168653508,Ts65Dn,Saline,C/S,t-CS-s 182 | 3498_1,0.787914003,1.119407321,0.320743754,2.302827813,4.17606043,0.174801472,Ts65Dn,Saline,C/S,t-CS-s 183 | 3498_2,0.842680986,1.051809865,0.33959825,2.334526651,4.295942721,0.171837709,Ts65Dn,Saline,C/S,t-CS-s 184 | 3498_3,0.880698548,1.065387349,0.339729922,2.308457711,4.363894812,0.176972281,Ts65Dn,Saline,C/S,t-CS-s 185 | 3498_4,0.878349022,1.036809076,0.289645185,2.064687425,3.713492638,0.178976587,Ts65Dn,Saline,C/S,t-CS-s 186 | 3498_5,0.842452208,1.145550428,0.324456163,2.280158207,3.777455504,0.189716546,Ts65Dn,Saline,C/S,t-CS-s 187 | 3498_6,0.941414934,1.165424349,0.322087093,2.250948084,3.720282464,0.188962992,Ts65Dn,Saline,C/S,t-CS-s 188 | 3498_7,0.824637681,1.004991948,0.268760064,2.101449275,3.27037037,0.187439614,Ts65Dn,Saline,C/S,t-CS-s 189 | 3498_8,0.838115774,1.034168187,0.287444021,2.110963676,3.346491956,0.191905789,Ts65Dn,Saline,C/S,t-CS-s 190 | 3498_9,0.818823529,0.994285714,0.290756303,2.120336134,3.685210084,0.202689076,Ts65Dn,Saline,C/S,t-CS-s 191 | 3498_10,0.743142145,0.839056206,0.24515634,1.838480721,2.917130251,0.19106081,Ts65Dn,Saline,C/S,t-CS-s 192 | 3498_11,0.754728493,0.875533862,0.266422615,1.968476713,2.971934106,0.195241001,Ts65Dn,Saline,C/S,t-CS-s 193 | 3498_12,0.718855932,0.93559322,0.28220339,2.070974576,3.163559322,0.216313559,Ts65Dn,Saline,C/S,t-CS-s 194 | 3498_13,0.674397859,0.801070473,0.254906334,1.861730598,2.691347012,0.199598573,Ts65Dn,Saline,C/S,t-CS-s 195 | 3498_14,0.759660697,0.912582469,0.262723845,1.926720075,2.988925542,0.200282752,Ts65Dn,Saline,C/S,t-CS-s 196 | 3498_15,0.713425513,0.805307761,0.265834077,1.860392507,2.822033898,0.205842997,Ts65Dn,Saline,C/S,t-CS-s 197 | 50810B_1,0.690987124,0.969957082,0.342748777,2.61772632,4.649765446,0.165285957,Ts65Dn,Saline,C/S,t-CS-s 198 | 50810B_2,0.704525022,0.962141644,0.343921686,2.618719409,4.739986015,0.170112876,Ts65Dn,Saline,C/S,t-CS-s 199 | 50810B_3,0.665815826,0.923817004,0.337325741,2.607500491,4.76919301,0.16964461,Ts65Dn,Saline,C/S,t-CS-s 200 | 50810B_4,0.596245955,0.821877023,0.304595469,2.377734628,4.168802589,0.175533981,Ts65Dn,Saline,C/S,t-CS-s 201 | 50810B_5,0.58123338,0.805369128,0.295302013,2.322274281,4.149930353,0.173610232,Ts65Dn,Saline,C/S,t-CS-s 202 | 50810B_6,0.576347305,0.800773453,0.292914172,2.264595808,4.184381238,0.178143713,Ts65Dn,Saline,C/S,t-CS-s 203 | 50810B_7,0.554536521,0.746642647,0.278250901,2.174582378,3.601703243,0.200131019,Ts65Dn,Saline,C/S,t-CS-s 204 | 50810B_8,0.554878049,0.748555841,0.271983312,2.144255456,3.671534018,0.183087291,Ts65Dn,Saline,C/S,t-CS-s 205 | 50810B_9,0.721025139,0.767548155,0.290728044,2.149200131,3.760855371,0.213026445,Ts65Dn,Saline,C/S,t-CS-s 206 | 50810B_10,0.483454851,0.652271453,0.255748738,1.936623668,3.149373715,0.190876799,Ts65Dn,Saline,C/S,t-CS-s 207 | 50810B_11,0.471245718,0.631332252,0.247881738,1.87236344,3.117901568,0.173427078,Ts65Dn,Saline,C/S,t-CS-s 208 | 50810B_12,0.489420423,0.64949402,0.258141674,1.946642134,3.232014719,0.201839926,Ts65Dn,Saline,C/S,t-CS-s 209 | 50810B_13,0.454020221,0.633124699,0.245064998,1.843283582,2.783100626,0.202696196,Ts65Dn,Saline,C/S,t-CS-s 210 | 50810B_14,0.451401869,0.631308411,0.245794393,1.810981308,2.760747664,0.198598131,Ts65Dn,Saline,C/S,t-CS-s 211 | 50810B_15,0.474926254,0.601089176,0.242114817,1.791014295,2.749262537,0.202859088,Ts65Dn,Saline,C/S,t-CS-s 212 | 50810C_1,0.583922694,0.962747707,0.442335971,2.883551572,4.420138646,0.196414817,Ts65Dn,Saline,C/S,t-CS-s 213 | 50810C_2,0.600599743,1.047693845,0.441596459,2.923104384,4.507068399,0.199771526,Ts65Dn,Saline,C/S,t-CS-s 214 | 50810C_3,0.577069887,0.980428899,0.464848359,2.995766535,4.380387258,0.201540704,Ts65Dn,Saline,C/S,t-CS-s 215 | 50810C_4,0.52425161,0.893899204,0.373247442,2.557313376,4.331849185,0.209738537,Ts65Dn,Saline,C/S,t-CS-s 216 | 50810C_5,0.509837631,0.900191022,0.381948424,2.662082139,4.28061127,0.213467049,Ts65Dn,Saline,C/S,t-CS-s 217 | 50810C_6,0.507273405,0.880082059,0.374207385,2.533196568,1.991141365,0.209716524,Ts65Dn,Saline,C/S,t-CS-s 218 | 50810C_7,0.452180028,0.793248945,0.33790436,2.45241444,4.013478669,0.211204876,Ts65Dn,Saline,C/S,t-CS-s 219 | 50810C_8,0.470532093,0.819374851,0.341565259,2.437842997,3.868289191,0.20949654,Ts65Dn,Saline,C/S,t-CS-s 220 | 50810C_9,0.466737816,0.822957429,0.342226965,2.498280564,4.132811574,0.212735681,Ts65Dn,Saline,C/S,t-CS-s 221 | 50810C_10,0.428082724,0.749028145,0.312548593,2.28487016,3.634737988,0.217384544,Ts65Dn,Saline,C/S,t-CS-s 222 | 50810C_11,0.441585424,0.761387246,0.301582228,2.342336583,3.844334346,0.225986895,Ts65Dn,Saline,C/S,t-CS-s 223 | 50810C_12,0.413541825,0.734173372,0.30803097,2.244724457,3.817822985,0.216031577,Ts65Dn,Saline,C/S,t-CS-s 224 | 50810C_13,0.408263901,0.694099643,0.294337698,2.139091991,3.393300459,0.222411155,Ts65Dn,Saline,C/S,t-CS-s 225 | 50810C_14,0.423482621,0.734912675,0.285146118,2.180356216,3.261801833,0.20888812,Ts65Dn,Saline,C/S,t-CS-s 226 | 50810C_15,0.456493863,0.769188496,0.309030958,2.316541491,3.5574281,0.245466203,Ts65Dn,Saline,C/S,t-CS-s 227 | 50810E_1,0.573991828,0.93311423,0.376709895,2.629863208,4.490939776,0.203855036,Ts65Dn,Saline,C/S,t-CS-s 228 | 50810E_2,0.611698818,0.926926838,0.383856343,2.578540315,4.336474353,0.203395857,Ts65Dn,Saline,C/S,t-CS-s 229 | 50810E_3,0.611508836,0.931128228,0.386225646,2.721975532,4.757589488,0.210149524,Ts65Dn,Saline,C/S,t-CS-s 230 | 50810E_4,0.537875952,0.80581555,0.333832522,2.341819543,3.794583801,0.211780856,Ts65Dn,Saline,C/S,t-CS-s 231 | 50810E_5,0.627634368,0.78077067,0.331712184,2.299912707,3.990896621,0.211497693,Ts65Dn,Saline,C/S,t-CS-s 232 | 50810E_6,0.593167313,0.771743211,0.330872231,2.34351145,3.839444375,0.208734827,Ts65Dn,Saline,C/S,t-CS-s 233 | 50810E_7,0.451539165,0.677384944,0.299756172,2.125114294,3.572691253,0.207711064,Ts65Dn,Saline,C/S,t-CS-s 234 | 50810E_8,0.517765685,0.71846991,0.306177977,2.233034571,3.695582586,0.219430218,Ts65Dn,Saline,C/S,t-CS-s 235 | 50810E_9,0.489535799,0.704956727,0.305586153,2.220456334,3.640912667,0.209913454,Ts65Dn,Saline,C/S,t-CS-s 236 | 50810E_10,0.418501529,0.667889908,0.29617737,2.193272171,3.573394495,0.19266055,Ts65Dn,Saline,C/S,t-CS-s 237 | 50810E_11,0.419344822,0.643688868,0.2906381,2.266884024,3.724421674,0.196863841,Ts65Dn,Saline,C/S,t-CS-s 238 | 50810E_12,0.439346812,0.658009331,0.296423017,2.231570762,3.67651633,0.205598756,Ts65Dn,Saline,C/S,t-CS-s 239 | 50810E_13,0.435826408,0.674053555,0.278855032,2.071468144,3.322622345,0.208864266,Ts65Dn,Saline,C/S,t-CS-s 240 | 50810E_14,0.424568566,0.659862683,0.276118018,2.081833364,3.193542401,0.229356096,Ts65Dn,Saline,C/S,t-CS-s 241 | 50810E_15,0.478822412,0.6662868,0.290978158,2.147198481,3.268945869,0.224121557,Ts65Dn,Saline,C/S,t-CS-s 242 | 293_1,0.364727273,0.649212121,0.333575758,2.670424242,4.657333333,0.263272727,Ts65Dn,Memantine,S/C,t-SC-m 243 | 293_2,0.31569446,0.613674828,0.301703712,2.490127496,4.046711046,0.242694347,Ts65Dn,Memantine,S/C,t-SC-m 244 | 293_3,0.322291159,0.59616663,0.296144472,2.439286506,3.895413251,0.238533127,Ts65Dn,Memantine,S/C,t-SC-m 245 | 293_4,0.311808118,0.583167755,0.313085439,2.391143911,3.937553222,0.244252058,Ts65Dn,Memantine,S/C,t-SC-m 246 | 293_5,0.305025997,0.589832467,0.302281918,2.454650491,3.894858463,0.252166378,Ts65Dn,Memantine,S/C,t-SC-m 247 | 293_6,0.28372093,0.559097127,0.283994528,2.32120383,3.685088919,0.242681259,Ts65Dn,Memantine,S/C,t-SC-m 248 | 293_7,0.272600349,0.535951134,0.302443281,2.378359511,3.683769634,0.259162304,Ts65Dn,Memantine,S/C,t-SC-m 249 | 293_8,0.248980258,0.515907978,0.279164627,2.229564366,3.390438897,0.233643335,Ts65Dn,Memantine,S/C,t-SC-m 250 | 293_9,0.255256242,0.518396846,0.296649146,2.24195138,3.432490145,0.249671485,Ts65Dn,Memantine,S/C,t-SC-m 251 | 293_10,0.259435919,0.511198673,0.278100373,2.164869349,3.293654085,0.26171713,Ts65Dn,Memantine,S/C,t-SC-m 252 | 293_11,0.226645004,0.490251828,0.270511779,2.113119415,3.097887896,0.264419171,Ts65Dn,Memantine,S/C,t-SC-m 253 | 293_12,0.226490596,0.478991597,0.274509804,2.087635054,2.906162465,0.259303721,Ts65Dn,Memantine,S/C,t-SC-m 254 | 293_13,0.227418164,0.444006891,0.310115678,2.093034703,2.882599065,0.273935516,Ts65Dn,Memantine,S/C,t-SC-m 255 | 293_14,0.191463996,0.443252265,0.262756319,1.998092513,2.582260372,0.261087268,Ts65Dn,Memantine,S/C,t-SC-m 256 | 293_15,0.209521448,0.461939003,0.29407389,2.100917431,2.607736177,0.287379122,Ts65Dn,Memantine,S/C,t-SC-m 257 | 3411_1,0.349903939,0.622958694,0.34414025,2.775936599,5.471661864,0.249879923,Ts65Dn,Memantine,S/C,t-SC-m 258 | 3411_2,0.340884703,0.62811494,0.328603792,2.704661977,5.296649577,0.244902826,Ts65Dn,Memantine,S/C,t-SC-m 259 | 3411_3,0.347139819,0.603604612,0.311877309,2.356878988,4.719579089,0.235195343,Ts65Dn,Memantine,S/C,t-SC-m 260 | 3411_4,0.308720209,0.556137209,0.31560821,2.450613032,4.406943105,0.260641962,Ts65Dn,Memantine,S/C,t-SC-m 261 | 3411_5,0.317157215,0.585498923,0.319454415,2.521751615,4.650107681,0.23833453,Ts65Dn,Memantine,S/C,t-SC-m 262 | 3411_6,0.286101782,0.529062258,0.288943425,2.253552054,4.067811935,0.216223198,Ts65Dn,Memantine,S/C,t-SC-m 263 | 3411_7,0.295752762,0.521926796,0.316298343,2.378970994,4.236705801,0.25086326,Ts65Dn,Memantine,S/C,t-SC-m 264 | 3411_8,0.294584107,0.529778978,0.307069344,2.337438839,4.084528429,0.243462122,Ts65Dn,Memantine,S/C,t-SC-m 265 | 3411_9,0.284056102,0.510720619,0.282927616,2.181202644,3.853941641,0.227309366,Ts65Dn,Memantine,S/C,t-SC-m 266 | 3411_10,0.282061526,0.482620855,0.295844986,2.189972034,3.363763484,0.237115461,Ts65Dn,Memantine,S/C,t-SC-m 267 | 3411_11,0.278591215,0.488326078,0.295211713,2.094974278,3.440047487,0.239810051,Ts65Dn,Memantine,S/C,t-SC-m 268 | 3411_12,0.288450264,0.515536447,0.286300567,2.043971077,3.312487786,0.218682822,Ts65Dn,Memantine,S/C,t-SC-m 269 | 3411_13,0.264373124,0.451858693,0.307088432,2.07850381,3.149157239,0.238513045,Ts65Dn,Memantine,S/C,t-SC-m 270 | 3411_14,0.268903592,0.473771267,0.303402647,2.108695652,3.184073724,0.273393195,Ts65Dn,Memantine,S/C,t-SC-m 271 | 3411_15,0.257819687,0.466881325,0.298298068,2.015869365,3.039328427,0.235970561,Ts65Dn,Memantine,S/C,t-SC-m 272 | 3418_1,0.330477356,0.567581745,0.355306872,2.735093548,4.751005421,0.253365973,Ts65Dn,Memantine,S/C,t-SC-m 273 | 3418_2,0.324465398,0.536453948,0.333894595,2.618117528,4.626873211,0.243306954,Ts65Dn,Memantine,S/C,t-SC-m 274 | 3418_3,0.30016,0.51216,0.32032,2.41296,4.0896,0.22848,Ts65Dn,Memantine,S/C,t-SC-m 275 | 3418_4,0.309139235,0.512574116,0.347986097,2.524023717,4.139848702,0.244326314,Ts65Dn,Memantine,S/C,t-SC-m 276 | 3418_5,0.304793118,0.515977059,0.37013519,2.443875461,3.955141336,0.253174928,Ts65Dn,Memantine,S/C,t-SC-m 277 | 3418_6,0.286352165,0.481459911,0.312560668,2.305571734,3.874005048,0.223451757,Ts65Dn,Memantine,S/C,t-SC-m 278 | 3418_7,0.28725755,0.473361159,0.328750307,2.387429413,3.449791309,0.245764793,Ts65Dn,Memantine,S/C,t-SC-m 279 | 3418_8,0.356881214,0.498953428,0.347462062,2.397697541,3.580586081,0.281266353,Ts65Dn,Memantine,S/C,t-SC-m 280 | 3418_9,0.264327485,0.444678363,0.287719298,2.12,3.263157895,0.241169591,Ts65Dn,Memantine,S/C,t-SC-m 281 | 3418_10,0.250610252,0.40981828,0.31787361,1.968538107,2.791429346,0.225657716,Ts65Dn,Memantine,S/C,t-SC-m 282 | 3418_11,0.27130887,0.442068766,0.319849754,2.097370702,2.899451026,0.239815082,Ts65Dn,Memantine,S/C,t-SC-m 283 | 3418_12,0.265762171,0.398244214,0.295291301,1.913008779,2.715349827,0.253790902,Ts65Dn,Memantine,S/C,t-SC-m 284 | 3418_13,0.263079223,0.390732436,0.294469357,1.843049327,2.552167414,0.235575486,Ts65Dn,Memantine,S/C,t-SC-m 285 | 3418_14,0.251702786,0.376160991,0.307430341,1.920433437,2.49380805,0.239318885,Ts65Dn,Memantine,S/C,t-SC-m 286 | 3418_15,0.252289233,0.402904957,0.303125987,1.918850647,2.520682033,0.222923903,Ts65Dn,Memantine,S/C,t-SC-m 287 | 3501_1,0.342508324,0.71054384,0.362708102,2.79145394,5.502663707,0.263152053,Ts65Dn,Memantine,S/C,t-SC-m 288 | 3501_2,0.34324204,0.70329548,0.363838789,2.860164774,5.63905589,0.264195057,Ts65Dn,Memantine,S/C,t-SC-m 289 | 3501_3,0.342134093,0.707274321,0.370070114,2.892638037,6.492659947,0.276730938,Ts65Dn,Memantine,S/C,t-SC-m 290 | 3501_4,0.32630854,0.653168044,0.349724518,2.728236915,5.089393939,0.262396694,Ts65Dn,Memantine,S/C,t-SC-m 291 | 3501_5,0.332271027,0.660523763,0.353193848,2.832201746,5.197311902,0.268809755,Ts65Dn,Memantine,S/C,t-SC-m 292 | 3501_6,0.335847504,0.675671969,0.378771256,2.825287987,5.92402633,0.300877674,Ts65Dn,Memantine,S/C,t-SC-m 293 | 3501_7,0.304788056,0.617298782,0.335163892,2.638235799,4.87660889,0.280590355,Ts65Dn,Memantine,S/C,t-SC-m 294 | 3501_8,0.30227882,0.623156836,0.345006702,2.629859249,4.593163539,0.283847185,Ts65Dn,Memantine,S/C,t-SC-m 295 | 3501_9,0.298825503,0.627516779,0.348993289,2.665436242,5.242281879,0.290771812,Ts65Dn,Memantine,S/C,t-SC-m 296 | 3501_10,0.301658449,0.611385029,0.321604662,2.430300314,4.085387719,0.317794711,Ts65Dn,Memantine,S/C,t-SC-m 297 | 3501_11,0.326462766,0.619237589,0.328235816,2.432402482,3.945257092,0.279920213,Ts65Dn,Memantine,S/C,t-SC-m 298 | 3501_12,0.344929513,0.626193724,0.383583447,2.534561164,4.097316962,0.303547067,Ts65Dn,Memantine,S/C,t-SC-m 299 | 3501_13,0.28934276,0.582089552,0.349829798,2.398795496,3.786855198,0.320764598,Ts65Dn,Memantine,S/C,t-SC-m 300 | 3501_14,0.351955307,0.60415004,0.378558127,2.457302474,3.810055866,0.316307529,Ts65Dn,Memantine,S/C,t-SC-m 301 | 3501_15,0.316243929,0.615488397,0.364004317,2.565569347,3.677280086,0.328116568,Ts65Dn,Memantine,S/C,t-SC-m 302 | 3502_1,0.281035689,0.563610917,0.376906928,2.528481456,4.990762771,0.280895731,Ts65Dn,Memantine,S/C,t-SC-m 303 | 3502_2,0.293219129,0.578158458,0.405281941,2.686509636,5.411991435,0.293076374,Ts65Dn,Memantine,S/C,t-SC-m 304 | 3502_3,0.308938468,0.58675572,0.397754725,2.673014068,6.215859031,0.299985789,Ts65Dn,Memantine,S/C,t-SC-m 305 | 3502_4,0.282781809,0.568748894,0.360998053,2.524685896,4.791010441,0.295699876,Ts65Dn,Memantine,S/C,t-SC-m 306 | 3502_5,0.30311064,0.569459173,0.377518558,2.54524567,4.829268293,0.299752563,Ts65Dn,Memantine,S/C,t-SC-m 307 | 3502_6,0.302090716,0.57902197,0.394223955,2.651842665,5.603472714,0.312189936,Ts65Dn,Memantine,S/C,t-SC-m 308 | 3502_7,0.285682023,0.51535682,0.350045167,2.480126468,4.256323397,0.348915989,Ts65Dn,Memantine,S/C,t-SC-m 309 | 3502_8,0.252850877,0.529385965,0.35745614,2.478508772,4.535307018,0.310964912,Ts65Dn,Memantine,S/C,t-SC-m 310 | 3502_9,0.27897458,0.52800517,0.361912969,2.520896165,4.763679449,0.359974149,Ts65Dn,Memantine,S/C,t-SC-m 311 | 3502_10,0.262447257,0.544303797,0.373277075,2.545428973,3.875668073,0.339803094,Ts65Dn,Memantine,S/C,t-SC-m 312 | 3502_11,0.270999725,0.512806389,0.384742495,2.507022859,4.273753787,0.35665106,Ts65Dn,Memantine,S/C,t-SC-m 313 | 3502_12,0.290473712,0.518740239,0.38209266,2.416189485,4.279541905,0.326132223,Ts65Dn,Memantine,S/C,t-SC-m 314 | 3502_13,0.22092145,0.468277946,0.351963746,2.570996979,3.702416918,0.369712991,Ts65Dn,Memantine,S/C,t-SC-m 315 | 3502_14,0.257121987,0.458728999,0.335646457,2.477720964,3.80715851,0.434623813,Ts65Dn,Memantine,S/C,t-SC-m 316 | 3502_15,0.261644833,0.463973799,0.401746725,2.539665211,4.097525473,0.392285298,Ts65Dn,Memantine,S/C,t-SC-m 317 | 3530_1,0.333635892,0.602178423,0.324040456,2.8344139,5.132131743,0.242997925,Ts65Dn,Memantine,S/C,t-SC-m 318 | 3530_2,0.382975975,0.588607595,0.307672436,2.77124774,5.116507362,0.245672953,Ts65Dn,Memantine,S/C,t-SC-m 319 | 3530_3,0.940955587,0.608701282,0.321766153,2.789071604,5.36902758,0.239673702,Ts65Dn,Memantine,S/C,t-SC-m 320 | 3530_4,0.343283582,0.576451078,0.323880597,2.755389718,4.482089552,0.25920398,Ts65Dn,Memantine,S/C,t-SC-m 321 | 3530_5,0.326129032,0.556451613,0.301774194,2.673548387,4.675806452,0.252419355,Ts65Dn,Memantine,S/C,t-SC-m 322 | 3530_6,0.338065941,0.562233791,0.301782616,2.600567913,4.394541726,0.245937845,Ts65Dn,Memantine,S/C,t-SC-m 323 | 3530_7,0.283811475,0.542622951,0.307172131,2.68852459,4.158811475,0.281147541,Ts65Dn,Memantine,S/C,t-SC-m 324 | 3530_8,0.274880573,0.522492038,0.292993631,2.603702229,4.332404459,0.267515924,Ts65Dn,Memantine,S/C,t-SC-m 325 | 3530_9,0.284920483,0.514083158,0.287794597,2.471163058,4.001341253,0.259053459,Ts65Dn,Memantine,S/C,t-SC-m 326 | 3530_10,0.299533513,0.542106555,0.293150012,2.490547508,3.437269826,0.271298797,Ts65Dn,Memantine,S/C,t-SC-m 327 | 3530_11,0.2964787,0.541738488,0.300911106,2.507017976,3.555035705,0.276779118,Ts65Dn,Memantine,S/C,t-SC-m 328 | 3530_12,0.293580247,0.533580247,0.34691358,2.48,3.540246914,0.275308642,Ts65Dn,Memantine,S/C,t-SC-m 329 | 3530_13,0.278592375,0.52228739,0.307038123,2.351612903,3.07888563,0.32228739,Ts65Dn,Memantine,S/C,t-SC-m 330 | 3530_14,0.276785714,0.502678571,0.356547619,2.406845238,3.095238095,0.32202381,Ts65Dn,Memantine,S/C,t-SC-m 331 | 3530_15,0.341388804,0.550321199,0.362496176,2.449984705,3.456714592,0.338329764,Ts65Dn,Memantine,S/C,t-SC-m 332 | 3534_1,0.424200471,0.682403433,0.340994047,2.677973141,4.52443583,0.278000831,Ts65Dn,Memantine,S/C,t-SC-m 333 | 3534_2,0.436950147,0.675743611,0.331378299,2.742214774,5.073034492,0.281804217,Ts65Dn,Memantine,S/C,t-SC-m 334 | 3534_3,0.424732696,0.704698931,0.341868317,2.735790658,5.081879572,0.299099606,Ts65Dn,Memantine,S/C,t-SC-m 335 | 3534_4,0.372619829,0.621634931,0.292350624,2.470617203,4.060242942,0.271831911,Ts65Dn,Memantine,S/C,t-SC-m 336 | 3534_5,0.40312229,0.66764961,0.31951431,2.572072853,4.238508239,0.273720729,Ts65Dn,Memantine,S/C,t-SC-m 337 | 3534_6,0.399506782,0.662321649,0.318478069,2.536022547,4.820151488,0.301567729,Ts65Dn,Memantine,S/C,t-SC-m 338 | 3534_7,0.339455221,0.553446141,0.278992984,2.388774247,3.665910029,0.269706975,Ts65Dn,Memantine,S/C,t-SC-m 339 | 3534_8,0.378192745,0.59927023,0.300922945,2.434427989,4.029405452,0.281605495,Ts65Dn,Memantine,S/C,t-SC-m 340 | 3534_9,0.336807003,0.58336807,0.285118799,2.403293039,4.066069195,0.277615673,Ts65Dn,Memantine,S/C,t-SC-m 341 | 3534_10,0.330657301,0.556447566,0.28775715,2.326894129,3.102107376,0.286001004,Ts65Dn,Memantine,S/C,t-SC-m 342 | 3534_11,0.33877753,0.540955209,0.290522148,2.246473645,3.357584756,0.274189557,Ts65Dn,Memantine,S/C,t-SC-m 343 | 3534_12,0.349507202,0.561789234,0.292898661,2.278493808,3.554207733,0.289360627,Ts65Dn,Memantine,S/C,t-SC-m 344 | 3534_13,0.340852905,0.52039555,0.322620519,2.232076638,3.17552534,0.314585909,Ts65Dn,Memantine,S/C,t-SC-m 345 | 3534_14,0.340064103,0.538782051,0.304166667,2.335576923,3.3375,0.329487179,Ts65Dn,Memantine,S/C,t-SC-m 346 | 3534_15,0.327130852,0.517406963,0.317226891,2.216986795,3.167767107,0.322328932,Ts65Dn,Memantine,S/C,t-SC-m 347 | 3605_1,0.387451401,0.634535461,0.323769942,2.440541628,5.293336908,0.234213702,Ts65Dn,Memantine,S/C,t-SC-m 348 | 3605_2,0.40726419,0.670211297,0.33462229,2.589283248,5.204391659,0.237536252,Ts65Dn,Memantine,S/C,t-SC-m 349 | 3605_3,0.463199348,0.656572515,0.335551331,2.5640956,5.247827268,0.249864204,Ts65Dn,Memantine,S/C,t-SC-m 350 | 3605_4,0.37557377,0.618852459,0.317704918,2.33,4.292295082,0.24442623,Ts65Dn,Memantine,S/C,t-SC-m 351 | 3605_5,0.389022298,0.639279588,0.328301887,2.426758148,4.889879931,0.251286449,Ts65Dn,Memantine,S/C,t-SC-m 352 | 3605_6,0.408919383,0.639279588,0.332590051,2.507204117,4.900171527,0.255060034,Ts65Dn,Memantine,S/C,t-SC-m 353 | 3605_7,0.370727784,0.570365903,0.309609972,2.1982308,4.102533172,0.262364294,Ts65Dn,Memantine,S/C,t-SC-m 354 | 3605_8,0.378715444,0.611099564,0.313864062,2.321346913,4.261276242,0.265225525,Ts65Dn,Memantine,S/C,t-SC-m 355 | 3605_9,0.379188345,0.608740895,0.320291363,2.376690947,4.177939646,0.263891779,Ts65Dn,Memantine,S/C,t-SC-m 356 | 3605_10,0.363454318,0.563204005,0.318397997,2.119649562,3.406257822,0.279849812,Ts65Dn,Memantine,S/C,t-SC-m 357 | 3605_11,0.381261355,0.596937451,0.332208669,2.268102777,3.773423307,0.286789515,Ts65Dn,Memantine,S/C,t-SC-m 358 | 3605_12,0.375228639,0.598902535,0.338646459,2.288476614,3.706297361,0.281944082,Ts65Dn,Memantine,S/C,t-SC-m 359 | 3605_13,0.358473824,0.577343981,0.327122153,2.089618456,3.133688258,0.316770186,Ts65Dn,Memantine,S/C,t-SC-m 360 | 3605_14,0.344549899,0.53781996,0.324705206,2.056945643,3.148403796,0.294506759,Ts65Dn,Memantine,S/C,t-SC-m 361 | 3605_15,0.408917197,0.580573248,0.37388535,2.30955414,3.51433121,0.310828025,Ts65Dn,Memantine,S/C,t-SC-m 362 | 3606_1,0.486174589,0.781878428,0.322897623,2.288391225,4.811585923,0.23857404,Ts65Dn,Memantine,S/C,t-SC-m 363 | 3606_2,0.476542665,0.75836185,0.303896677,2.242852412,4.78662104,0.238988851,Ts65Dn,Memantine,S/C,t-SC-m 364 | 3606_3,0.489683166,0.786221671,0.318074191,2.300710339,5.008343669,0.244559702,Ts65Dn,Memantine,S/C,t-SC-m 365 | 3606_4,0.424989375,0.679699674,0.291967701,2.241535628,4.343674741,0.220569486,Ts65Dn,Memantine,S/C,t-SC-m 366 | 3606_5,0.403120416,0.649019869,0.277103614,2.088145086,4.158687825,0.216428857,Ts65Dn,Memantine,S/C,t-SC-m 367 | 3606_6,0.414507062,0.675030852,0.276840806,2.202248732,4.440010969,0.240641711,Ts65Dn,Memantine,S/C,t-SC-m 368 | 3606_7,0.413705584,0.64179357,0.281387479,2.151099831,3.842978003,0.227411168,Ts65Dn,Memantine,S/C,t-SC-m 369 | 3606_8,0.396520597,0.625471853,0.268012473,2.026587888,3.763827343,0.218775644,Ts65Dn,Memantine,S/C,t-SC-m 370 | 3606_9,0.399572298,0.632998848,0.274716236,2.04227669,3.982891923,0.238855075,Ts65Dn,Memantine,S/C,t-SC-m 371 | 3606_10,0.369756497,0.57253939,0.272150604,1.903212605,3.255780643,0.214651115,Ts65Dn,Memantine,S/C,t-SC-m 372 | 3606_11,0.390426639,0.584183143,0.28491155,1.953173777,3.424141519,0.219771072,Ts65Dn,Memantine,S/C,t-SC-m 373 | 3606_12,0.361477046,0.567864271,0.273053892,1.84510978,3.310179641,0.214570858,Ts65Dn,Memantine,S/C,t-SC-m 374 | 3606_13,0.344771994,0.541225242,0.268309535,1.787655458,2.835099033,0.209580838,Ts65Dn,Memantine,S/C,t-SC-m 375 | 3606_14,0.362089915,0.582989064,0.286512758,1.889914945,3.128311057,0.228432564,Ts65Dn,Memantine,S/C,t-SC-m 376 | 3606_15,0.353036625,0.536624942,0.264487714,1.802271674,2.998840983,0.22160408,Ts65Dn,Memantine,S/C,t-SC-m 377 | 3421_1,0.30010089,0.584518023,0.323672384,2.02806567,3.253324773,0.215078419,Ts65Dn,Saline,S/C,t-SC-s 378 | 3421_2,0.296766423,0.586305939,0.317242657,2.011118317,3.233762624,0.215232095,Ts65Dn,Saline,S/C,t-SC-s 379 | 3421_3,0.318265952,0.613151486,0.345640526,2.153044325,3.378373113,0.220555285,Ts65Dn,Saline,S/C,t-SC-s 380 | 3421_4,0.286237741,0.519021446,0.300678952,1.817544994,2.763013256,0.20756547,Ts65Dn,Saline,S/C,t-SC-s 381 | 3421_5,0.278368993,0.503528621,0.301781113,1.913744819,2.786042343,0.20858071,Ts65Dn,Saline,S/C,t-SC-s 382 | 3421_6,0.298557804,0.541521284,0.310188416,1.924401023,2.976738776,0.221330542,Ts65Dn,Saline,S/C,t-SC-s 383 | 3421_7,0.237556561,0.420933556,0.250059538,1.501547988,2.163610383,0.18706835,Ts65Dn,Saline,S/C,t-SC-s 384 | 3421_8,0.252389804,0.460966543,0.258629846,1.714285714,2.420074349,0.202469464,Ts65Dn,Saline,S/C,t-SC-s 385 | 3421_9,0.263753359,0.489605431,0.277329939,1.781643332,2.626361194,0.215528214,Ts65Dn,Saline,S/C,t-SC-s 386 | 3421_10,0.238836364,0.384145455,0.234618182,1.44,1.928436364,0.198690909,Ts65Dn,Saline,S/C,t-SC-s 387 | 3421_11,0.226899537,0.395432154,0.248693835,1.460665771,1.860128377,0.188535602,Ts65Dn,Saline,S/C,t-SC-s 388 | 3421_12,0.261107314,0.443779904,0.276657553,1.674128503,2.256493506,0.218215995,Ts65Dn,Saline,S/C,t-SC-s 389 | 3421_13,0.216134185,0.364057508,0.241693291,1.330830671,1.737539936,0.197124601,Ts65Dn,Saline,S/C,t-SC-s 390 | 3421_14,0.212369478,0.369959839,0.239036145,1.346827309,1.814939759,0.194538153,Ts65Dn,Saline,S/C,t-SC-s 391 | 3421_15,0.25728988,0.432628168,0.289689346,1.589289118,2.125976749,0.232704403,Ts65Dn,Saline,S/C,t-SC-s 392 | 3425_1,0.37869997,0.738617367,0.318812076,2.426885633,4.070213394,0.219097256,Ts65Dn,Saline,S/C,t-SC-s 393 | 3425_2,0.364971751,0.702542373,0.314783427,2.332015066,3.675235405,0.211770245,Ts65Dn,Saline,S/C,t-SC-s 394 | 3425_3,0.369857994,0.681355932,0.298396702,2.309665598,3.67924874,0.212093449,Ts65Dn,Saline,S/C,t-SC-s 395 | 3425_4,0.340110471,0.63039135,0.284404748,2.164179104,3.433540957,0.204489364,Ts65Dn,Saline,S/C,t-SC-s 396 | 3425_5,0.364356657,0.603838857,0.269501172,2.031692891,3.103894655,0.194397947,Ts65Dn,Saline,S/C,t-SC-s 397 | 3425_6,0.353143364,0.595631445,0.261558931,2.055105888,3.070517796,0.197915512,Ts65Dn,Saline,S/C,t-SC-s 398 | 3425_7,0.306110712,0.547951114,0.260963336,1.975557153,2.908123652,0.188641265,Ts65Dn,Saline,S/C,t-SC-s 399 | 3425_8,0.278722045,0.492907348,0.234376997,1.773929712,2.554504792,0.175463259,Ts65Dn,Saline,S/C,t-SC-s 400 | 3425_9,0.274203945,0.491040351,0.235013536,1.768982854,2.596106742,0.183060462,Ts65Dn,Saline,S/C,t-SC-s 401 | 3425_10,0.273416887,0.480870712,0.246042216,1.733509235,2.428100264,0.18469657,Ts65Dn,Saline,S/C,t-SC-s 402 | 3425_11,0.254252874,0.435862069,0.207662835,1.590038314,2.152337165,0.171494253,Ts65Dn,Saline,S/C,t-SC-s 403 | 3425_12,0.261084505,0.440908389,0.216283022,1.619032906,2.194963695,0.185539935,Ts65Dn,Saline,S/C,t-SC-s 404 | 3425_13,0.235262206,0.411392405,0.203435805,1.484990958,1.944122966,0.165461121,Ts65Dn,Saline,S/C,t-SC-s 405 | 3425_14,0.235136583,0.390108909,0.206748795,1.466880914,1.836636315,0.165684699,Ts65Dn,Saline,S/C,t-SC-s 406 | 3425_15,0.226490527,0.380497132,0.194159569,1.414913958,1.7947158,0.162350078,Ts65Dn,Saline,S/C,t-SC-s 407 | 3426_1,0.500643119,0.828336796,0.409320273,2.68328881,4.594835263,0.252003562,Ts65Dn,Saline,S/C,t-SC-s 408 | 3426_2,0.478054342,0.807524226,0.38732662,2.608018241,4.36699601,0.241022231,Ts65Dn,Saline,S/C,t-SC-s 409 | 3426_3,0.490755977,0.836221082,0.376439841,2.620559481,4.414287097,0.250120995,Ts65Dn,Saline,S/C,t-SC-s 410 | 3426_4,0.484586466,0.74160401,0.382957393,2.445614035,4.281578947,0.25764411,Ts65Dn,Saline,S/C,t-SC-s 411 | 3426_5,0.440089191,0.711653562,0.347259711,2.367210421,3.683957282,0.241168877,Ts65Dn,Saline,S/C,t-SC-s 412 | 3426_6,0.452596073,0.729309722,0.347187086,2.384170582,3.941573304,0.244187447,Ts65Dn,Saline,S/C,t-SC-s 413 | 3426_7,0.420346388,0.666250585,0.344047433,2.308472461,3.622405992,0.246060228,Ts65Dn,Saline,S/C,t-SC-s 414 | 3426_8,0.39416893,0.62369587,0.316564242,2.104044591,3.314706303,0.234529084,Ts65Dn,Saline,S/C,t-SC-s 415 | 3426_9,0.40173887,0.659571279,0.321840803,2.183930445,3.411782341,0.236546245,Ts65Dn,Saline,S/C,t-SC-s 416 | 3426_10,0.382181818,0.586545455,0.318545455,2.072,3.073636364,0.259636364,Ts65Dn,Saline,S/C,t-SC-s 417 | 3426_11,0.365621698,0.572208524,0.297992251,2.004931314,2.783550546,0.245332864,Ts65Dn,Saline,S/C,t-SC-s 418 | 3426_12,0.365604868,0.599498926,0.301539012,2.062813171,2.952576951,0.248568361,Ts65Dn,Saline,S/C,t-SC-s 419 | 3491_1,0.45099035,0.714660572,0.383866599,2.598103944,4.396478754,0.267902489,Ts65Dn,Saline,S/C,t-SC-s 420 | 3491_2,0.430101997,0.725550699,0.401131396,2.647295792,4.216250964,0.271277963,Ts65Dn,Saline,S/C,t-SC-s 421 | 3491_3,0.422576225,0.72045221,0.380524152,2.646282974,4.377440904,0.2995889,Ts65Dn,Saline,S/C,t-SC-s 422 | 3491_4,0.395634668,0.638482729,0.353676626,2.509218055,3.98018648,0.262237762,Ts65Dn,Saline,S/C,t-SC-s 423 | 3491_5,0.391900377,0.63614483,0.352658016,2.413980745,3.807974048,0.260150691,Ts65Dn,Saline,S/C,t-SC-s 424 | 3491_6,0.383192765,0.626562341,0.332892999,2.357280764,3.722589168,0.251702063,Ts65Dn,Saline,S/C,t-SC-s 425 | 3491_7,0.372281167,0.577851459,0.3433687,2.235676393,3.409814324,0.253448276,Ts65Dn,Saline,S/C,t-SC-s 426 | 3491_8,0.347121369,0.565093361,0.313407676,2.157157676,3.305108921,0.24598029,Ts65Dn,Saline,S/C,t-SC-s 427 | 3491_9,0.330275229,0.542507645,0.289785933,2.051009174,3.117675841,0.24,Ts65Dn,Saline,S/C,t-SC-s 428 | 3491_10,0.422991643,0.573767696,0.363295241,2.321848883,3.563022344,0.270339417,Ts65Dn,Saline,S/C,t-SC-s 429 | 3491_11,0.468944622,0.568254503,0.385961959,2.250126241,3.358020535,0.268641643,Ts65Dn,Saline,S/C,t-SC-s 430 | 3491_12,0.373620945,0.561337066,0.361929853,2.1967726,3.411493496,0.280586201,Ts65Dn,Saline,S/C,t-SC-s 431 | 3491_13,0.43200681,0.538838051,0.358586933,2.208129389,2.952543094,0.285592679,Ts65Dn,Saline,S/C,t-SC-s 432 | 3491_14,0.411998328,0.536162207,0.362458194,2.115593645,2.903846154,0.300585284,Ts65Dn,Saline,S/C,t-SC-s 433 | 3491_15,0.354198767,0.485939908,0.356124807,1.955123267,2.864791988,0.288906009,Ts65Dn,Saline,S/C,t-SC-s 434 | 3513_1,0.423525668,0.668328384,0.374946966,2.846414934,5.449724226,0.258803564,Ts65Dn,Saline,S/C,t-SC-s 435 | 3513_2,0.431654676,0.699585786,0.387617179,2.855788097,5.53204709,0.261063876,Ts65Dn,Saline,S/C,t-SC-s 436 | 3513_3,0.425481289,0.698031581,0.380380705,2.874972961,5.279688514,0.254055808,Ts65Dn,Saline,S/C,t-SC-s 437 | 3513_4,0.410867238,0.614694861,0.399491435,2.748260171,4.919834047,0.263784797,Ts65Dn,Saline,S/C,t-SC-s 438 | 3513_5,0.402910659,0.636167632,0.357768495,2.67308988,4.682522571,0.261555046,Ts65Dn,Saline,S/C,t-SC-s 439 | 3513_6,0.358812841,0.585099939,0.312658995,2.443973349,4.370563295,0.221078134,Ts65Dn,Saline,S/C,t-SC-s 440 | 3513_7,0.394220846,0.573271414,0.366357069,2.590815273,4.496904025,0.254385965,Ts65Dn,Saline,S/C,t-SC-s 441 | 3513_8,0.388473308,0.573614417,0.336960218,2.517851071,4.293947637,0.285957157,Ts65Dn,Saline,S/C,t-SC-s 442 | 3513_9,0.344535126,0.552408385,0.317010722,2.355576892,4.024323892,0.232197152,Ts65Dn,Saline,S/C,t-SC-s 443 | 3513_10,0.356999599,0.526073004,0.332731649,2.373445648,3.885078219,0.254713197,Ts65Dn,Saline,S/C,t-SC-s 444 | 3513_11,0.324591968,0.482119934,0.292499542,2.145424537,3.425453879,0.233449477,Ts65Dn,Saline,S/C,t-SC-s 445 | 3513_12,0.349743395,0.506557689,0.303364379,2.18570614,3.532598365,0.228663752,Ts65Dn,Saline,S/C,t-SC-s 446 | 3513_13,0.341148886,0.483001172,0.325908558,2.246424385,3.480187573,0.272215709,Ts65Dn,Saline,S/C,t-SC-s 447 | 3513_14,0.331467226,0.492185678,0.317004899,2.233496618,3.41240961,0.288313506,Ts65Dn,Saline,S/C,t-SC-s 448 | 3513_15,0.312993386,0.48090463,0.291444421,2.003200341,3.039470877,0.262427992,Ts65Dn,Saline,S/C,t-SC-s 449 | 3517_1,0.415249589,0.655787164,0.403592979,3.035518376,5.781952825,0.259736698,Ts65Dn,Saline,S/C,t-SC-s 450 | 3517_2,0.385877412,0.612547578,0.390864943,2.858905368,5.372358577,0.250557816,Ts65Dn,Saline,S/C,t-SC-s 451 | 3517_3,0.397678917,0.624242424,0.370728562,2.7103804,5.16273372,0.245776918,Ts65Dn,Saline,S/C,t-SC-s 452 | 3517_4,0.35652729,0.565751676,0.375518672,2.709224386,4.730928822,0.248483881,Ts65Dn,Saline,S/C,t-SC-s 453 | 3517_5,0.33130654,0.52217114,0.344653715,2.459884324,4.255969153,0.233427258,Ts65Dn,Saline,S/C,t-SC-s 454 | 3517_6,0.348664238,0.545537341,0.385701275,2.483151184,4.333485124,0.253187614,Ts65Dn,Saline,S/C,t-SC-s 455 | 3517_7,0.361781848,0.565986678,0.376144879,2.774771024,4.450249792,0.262905912,Ts65Dn,Saline,S/C,t-SC-s 456 | 3517_8,0.329360575,0.503216042,0.326144533,2.487892546,3.925841846,0.231176693,Ts65Dn,Saline,S/C,t-SC-s 457 | 3517_9,0.328313813,0.50046477,0.363264547,2.409369771,3.796988288,0.226250232,Ts65Dn,Saline,S/C,t-SC-s 458 | 3517_10,0.377490298,0.528331177,0.379560155,2.689262613,3.978007762,0.266752911,Ts65Dn,Saline,S/C,t-SC-s 459 | 3517_11,0.367813384,0.478322337,0.346371348,2.356974552,3.561498586,0.252120641,Ts65Dn,Saline,S/C,t-SC-s 460 | 3517_12,0.296432432,0.430918919,0.314810811,2.175135135,3.218594595,0.233297297,Ts65Dn,Saline,S/C,t-SC-s 461 | 3517_13,0.300902425,0.426959955,0.395093063,2.196559504,3.129723632,0.239706712,Ts65Dn,Saline,S/C,t-SC-s 462 | 3517_14,0.287620064,0.402881537,0.361792956,2.049893276,2.749733191,0.274012807,Ts65Dn,Saline,S/C,t-SC-s 463 | 3517_15,0.28208323,0.378519811,0.336905059,1.870919512,2.692748567,0.206578619,Ts65Dn,Saline,S/C,t-SC-s 464 | 3525_1,0.437859667,0.705300353,0.417970722,2.796769308,5.460777385,0.279858657,Ts65Dn,Saline,S/C,t-SC-s 465 | 3525_2,0.450879007,0.735884178,0.435056877,2.974974147,5.829058945,0.293795243,Ts65Dn,Saline,S/C,t-SC-s 466 | 3525_3,0.441197654,0.734952156,0.44335837,2.978289948,6.201461056,0.296738348,Ts65Dn,Saline,S/C,t-SC-s 467 | 3525_4,0.412267658,0.645848823,0.403841388,2.594052045,5.178686493,0.288228005,Ts65Dn,Saline,S/C,t-SC-s 468 | 3525_5,0.430794534,0.667130567,0.425733806,2.637525304,5.378415992,0.29402834,Ts65Dn,Saline,S/C,t-SC-s 469 | 3525_6,0.423008625,0.675925926,0.439751395,2.702308473,5.899036022,0.302004059,Ts65Dn,Saline,S/C,t-SC-s 470 | 3525_7,0.382194684,0.60345671,0.383499103,2.470895157,4.552258275,0.289091798,Ts65Dn,Saline,S/C,t-SC-s 471 | 3525_8,0.399864223,0.637813985,0.405295316,2.652579769,5.181602172,0.304650373,Ts65Dn,Saline,S/C,t-SC-s 472 | 3525_9,0.391501784,0.624391826,0.4041518,2.623905287,5.215212455,0.304573467,Ts65Dn,Saline,S/C,t-SC-s 473 | 3525_10,0.364487927,0.587427144,0.420482931,2.543713572,4.521856786,0.321815154,Ts65Dn,Saline,S/C,t-SC-s 474 | 3525_11,0.382148693,0.595792484,0.399101307,2.527573529,4.629493464,0.317810458,Ts65Dn,Saline,S/C,t-SC-s 475 | 3525_12,0.387946518,0.586509679,0.431650369,2.527040511,4.78108162,0.316902814,Ts65Dn,Saline,S/C,t-SC-s 476 | 3525_13,0.343695162,0.562547004,0.361243419,2.412885435,3.949360742,0.330157934,Ts65Dn,Saline,S/C,t-SC-s 477 | 3525_14,0.346593734,0.551466932,0.390353058,2.445052213,4.236200895,0.343610144,Ts65Dn,Saline,S/C,t-SC-s 478 | 3525_15,0.365906887,0.5528613,0.386275461,2.473811833,4.347235694,0.353782735,Ts65Dn,Saline,S/C,t-SC-s 479 | J1291_1,0.277106869,0.514868199,0.320348007,2.36579665,3.371250487,0.234774705,Ts65Dn,Saline,S/C,t-SC-s 480 | J1291_2,0.287188989,0.523557438,0.319745897,2.425489677,3.589465326,0.244044468,Ts65Dn,Saline,S/C,t-SC-s 481 | J1291_3,0.289369559,0.526378264,0.32629913,2.383935637,3.457267212,0.237931944,Ts65Dn,Saline,S/C,t-SC-s 482 | J1291_4,0.256108877,0.455459326,0.303124033,2.213269409,3.148468914,0.236931642,Ts65Dn,Saline,S/C,t-SC-s 483 | J1291_5,0.268433005,0.447236942,0.300984103,2.157153671,3.037698713,0.235427706,Ts65Dn,Saline,S/C,t-SC-s 484 | J1291_6,0.273664183,0.476930395,0.329316632,2.222292691,3.265260821,0.238306643,Ts65Dn,Saline,S/C,t-SC-s 485 | J1291_7,0.237046878,0.413550958,0.296071361,2.140444107,2.790282786,0.241412033,Ts65Dn,Saline,S/C,t-SC-s 486 | J1291_8,0.293881453,0.400956023,0.279349904,2.124282983,3.002868069,0.247036329,Ts65Dn,Saline,S/C,t-SC-s 487 | J1291_9,0.237271854,0.408069164,0.283381364,2.131219981,3.005763689,0.247838617,Ts65Dn,Saline,S/C,t-SC-s 488 | J1291_10,0.207142857,0.373809524,0.276428571,2.082619048,2.733571429,0.29547619,Ts65Dn,Saline,S/C,t-SC-s 489 | J1291_11,0.249584422,0.377582522,0.275943956,2.052244123,2.655188791,0.257658513,Ts65Dn,Saline,S/C,t-SC-s 490 | J1291_12,0.20413561,0.401779274,0.274344794,2.081990863,2.828564559,0.268574176,Ts65Dn,Saline,S/C,t-SC-s 491 | J1291_13,0.20406547,0.328405491,0.25343189,1.889915523,2.403379092,0.271119324,Ts65Dn,Saline,S/C,t-SC-s 492 | J1291_14,0.163324538,0.332453826,0.255145119,1.901846966,2.44591029,0.539050132,Ts65Dn,Saline,S/C,t-SC-s 493 | J1291_15,0.175857339,0.3478738,0.282578875,2.007407407,2.587105624,0.261454047,Ts65Dn,Saline,S/C,t-SC-s 494 | J3295_1,0.359145674,0.634173056,0.344687842,2.715334064,4.20898138,0.223658269,Ts65Dn,Saline,S/C,t-SC-s 495 | J3295_2,0.357103615,0.63256785,0.354466542,2.694429184,4.292385452,0.226458631,Ts65Dn,Saline,S/C,t-SC-s 496 | J3295_3,0.374019278,0.661735037,0.362811029,2.791974894,4.477023089,0.222932078,Ts65Dn,Saline,S/C,t-SC-s 497 | J3295_4,0.356012037,0.585110559,0.313620306,2.545073924,3.79445244,0.221117362,Ts65Dn,Saline,S/C,t-SC-s 498 | J3295_5,0.329829172,0.573061761,0.334691196,2.548357424,3.808278581,0.229040736,Ts65Dn,Saline,S/C,t-SC-s 499 | J3295_6,0.35513649,0.588025847,0.314914941,2.544507451,3.981010154,0.224713174,Ts65Dn,Saline,S/C,t-SC-s 500 | J3295_7,0.318447798,0.509701263,0.290575916,2.314752079,3.041114875,0.229134586,Ts65Dn,Saline,S/C,t-SC-s 501 | J3295_8,0.333438486,0.514353312,0.316403785,2.3170347,3.451892744,0.235962145,Ts65Dn,Saline,S/C,t-SC-s 502 | J3295_9,0.280945758,0.528820893,0.299644568,2.290990573,3.243548138,0.246020708,Ts65Dn,Saline,S/C,t-SC-s 503 | J3295_10,0.230976538,0.423589093,0.254438808,1.868896639,2.447209892,0.209733672,Ts65Dn,Saline,S/C,t-SC-s 504 | J3295_11,0.254860375,0.463591375,0.254860375,2.092082008,2.600035348,0.211735596,Ts65Dn,Saline,S/C,t-SC-s 505 | J3295_12,0.272197962,0.474163028,0.251637555,2.161390102,2.801491994,0.251273654,Ts65Dn,Saline,S/C,t-SC-s 506 | J3295_13,0.228699552,0.395179372,0.234118087,1.733183857,2.220852018,0.220665172,Ts65Dn,Saline,S/C,t-SC-s 507 | J3295_14,0.221242406,0.412894376,0.243974133,1.876347247,2.384087791,0.208896727,Ts65Dn,Saline,S/C,t-SC-s 508 | J3295_15,0.302625723,0.46105919,0.256564308,2.092790387,2.59434802,0.251001335,Ts65Dn,Saline,S/C,t-SC-s 509 | -------------------------------------------------------------------------------- /Chapter18/brooklyn_sales_map.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Applied-Computational-Thinking-with-Python-Second-Edition/b8399777f44ab8b2ea65e5c1e2a1be658f66f76a/Chapter18/brooklyn_sales_map.zip -------------------------------------------------------------------------------- /Chapter18/ch18_BreastCancerSample.py: -------------------------------------------------------------------------------- 1 | #Import libraries needed 2 | import pandas as pd 3 | import matplotlib.pyplot as plt 4 | import seaborn as sns 5 | %matplotlib inline 6 | 7 | #Get data set. Remember to check your directory and/or add the full location of the file. 8 | dataset = pd.read_csv('C:\\...\\breast-cancer.csv') 9 | dataset.head() 10 | dataset.isnull().sum() 11 | 12 | #Create count variable for diagnosis 13 | count = dataset.diagnosis.value_counts() 14 | count 15 | 16 | #Create bargraph of the diagnosis values 17 | count.plot(kind = 'bar') 18 | plt.title('Tumor distribution (malignant: M, benign: B)') 19 | plt.xlabel('Diagnosis') 20 | plt.ylabel('count') 21 | plt.show() 22 | y_target = dataset['diagnosis'] 23 | dataset.columns.values 24 | dataset['target'] = dataset['diagnosis'].map({0:'B',1:'M'}) 25 | 26 | #Create scatterplot of mean perimeter and mean texture 27 | sns.scatterplot(x = 'perimeter_mean', y = 'texture_mean', data = dataset, hue = 'diagnosis', palette = 'bright'); 28 | -------------------------------------------------------------------------------- /Chapter18/ch18_CNN_mnist.py: -------------------------------------------------------------------------------- 1 | from keras.datasets import mnist 2 | #Grab the testing and training data from existing dataset 3 | (X_train, y_train), (X_test, y_test) = mnist.load_data() 4 | 5 | import matplotlib.pyplot as plt 6 | 7 | #Reshape the model 8 | X_train = X_train.reshape(60000,28,28,1) 9 | X_test = X_test.reshape(10000,28,28,1) 10 | 11 | from keras.utils import to_categorical 12 | #Use One-Hot encoding 13 | y_train = to_categorical(y_train) 14 | y_test = to_categorical(y_test) 15 | y_train[0] 16 | 17 | #Creating the model 18 | from keras.models import Sequential 19 | from keras.layers import Dense, Conv2D, Flatten 20 | 21 | model = Sequential() 22 | model.add(Conv2D(64, kernel_size=3, activation='relu', input_shape=(28,28,1))) 23 | model.add(Conv2D(32, kernel_size=3, activation='relu')) 24 | model.add(Flatten()) 25 | model.add(Dense(10, activation='softmax')) 26 | 27 | #Compile the model 28 | model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy']) 29 | 30 | #Train the model 31 | model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=3) 32 | 33 | #Predict last 4 images 34 | model.predict(X_test[9996:]) 35 | -------------------------------------------------------------------------------- /Chapter18/ch18_CovidPR.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | 4 | 5 | df = pd.read_csv('C:\\...\\us-PuertoRico.csv') 6 | 7 | plt.scatter(df['date'], df['deaths']) 8 | plt.xticks(rotation = 90) 9 | plt.title('Deaths per day during October 2020 due to COVID19 in Puerto Rico') 10 | plt.ylabel('Number of Deaths') 11 | plt.tight_layout() 12 | plt.savefig('COVID_PR.png') 13 | plt.show() 14 | 15 | -------------------------------------------------------------------------------- /Chapter18/ch18_CovidPR_2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | 4 | 5 | df = pd.read_csv('C:\\...\\us-PuertoRico.csv') 6 | 7 | plt.scatter(df['date'], df['cases']) 8 | plt.xticks(rotation = 90) 9 | plt.title('Cases per day during October 2020 due to COVID19 in Puerto Rico') 10 | plt.ylabel('Number of Cases') 11 | plt.tight_layout() 12 | plt.show() 13 | plt.savefig('COVID_PR.png') 14 | 15 | -------------------------------------------------------------------------------- /Chapter18/ch18_boxplot.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import scipy.stats as stats 3 | import matplotlib.pyplot as plt 4 | import seaborn as sns 5 | 6 | df = pd.read_csv('C:\\...\\Data_Cortex_Nuclear.csv') 7 | 8 | protein = df[['NR2A_N', 'class']].dropna() 9 | sns.boxplot(x='class', y='NR2A_N', data = protein) 10 | plt.show 11 | -------------------------------------------------------------------------------- /Chapter18/ch18_electricFieldLines.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import random 4 | 5 | np.seterr(divide='ignore', invalid='ignore') 6 | 7 | #Define the size of the electric field lines grid 8 | N = 20 9 | M = 25 10 | 11 | #Set the x and y coordinates 12 | x_coor = np.arange(0, M, 1) 13 | y_coor = np.arange(0, N, 1) 14 | x_coor, y_coor = np.meshgrid(x_coor, y_coor) 15 | 16 | E_x = np.zeros((N, M)) 17 | E_y = np.zeros((N, M)) 18 | 19 | #Set the number of total charges to plot 20 | nq = 3 21 | 22 | #Create empty lists to store coordinates of charges 23 | qq = [[], []] 24 | for dummy in range(nq): 25 | q = random.choice([-1, 1]) 26 | q_x, q_y = random.randrange(1, N), random.randrange(1, M) 27 | qq[0].append(q_y) 28 | qq[1].append(q_x) 29 | for i in range(N): 30 | for j in range(M): 31 | denom = ((i - q_x) ** 2 + (j - q_y) ** 2) ** 1.5 32 | if denom != 0: 33 | E_x[i, j] += q * (j - q_y) / denom 34 | E_y[i, j] += q * (i - q_x) / denom 35 | 36 | 37 | C = np.hypot(E_x, E_y) 38 | 39 | E = (E_x ** 2 + E_y ** 2) ** .5 40 | E_x = E_x / E 41 | E_y = E_y / E 42 | 43 | 44 | plt.figure(figsize=(12, 8)) 45 | 46 | #Plot charges 47 | plt.plot(*qq, 'ms') 48 | #Create 2D array 49 | rr =plt.quiver(x_coor, y_coor, E_x, E_y, C, pivot='middle') 50 | 51 | cbar = plt.colorbar() 52 | cbar.ax.set_ylabel('Magnitude') 53 | 54 | #Label graph 55 | plt.title('Electric Field Lines in Python') 56 | plt.axis('equal') 57 | plt.axis('off') 58 | plt.show() 59 | -------------------------------------------------------------------------------- /Chapter18/ch18_housingBrooklyn.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | 4 | df = pd.read_csv('C:\\...\\brooklyn_sales_map.csv') 5 | 6 | bins = [-100000000,20000,40000,60000,80000,100000,1000000,10000000,500000000] 7 | ranges_prices = ['$0-$200k','$200k-$400k','$400k-$600k','$600k-$800k','$800k-$1mlln','$1mlln-$10mlln','$10mlln-$100mlln','$100mlln-$500mlln'] 8 | df['price_range'] = pd.cut(df['sale_price'], bins = bins, labels = ranges_prices) 9 | def convert(year): 10 | return df[df['year_of_sale'] == year].groupby('price_range').size() 11 | percent_total = [x/sum(x)*100 for x in [convert(2003),convert(2004),convert(2005),convert(2006),convert(2007),convert(2008),convert(2009),convert(2010),convert(2011),convert(2012),convert(2013),convert(2014),convert(2015),convert(2016),convert(2017)]] 12 | year_names = list(range(2003,2018)) 13 | 14 | 15 | housing_df = pd.DataFrame(percent_total, index = year_names) 16 | ax_two = housing_df.plot(kind = 'barh', stacked = True, width = 0.9, cmap = 'Spectral') 17 | plt.legend(bbox_to_anchor = (1.45, 1), loc='upper right') 18 | 19 | ax_two.set_xlabel('Percentages', fontname='Arial', fontsize = 12) 20 | ax_two.set_ylabel('Years', fontname='Arial', fontsize = 12) 21 | ax_two.set_title('Housing Sale ') 22 | 23 | df.groupby(['neighborhood','price_range']).size().unstack().plot.bar(stacked = True, cmap = 'rainbow') 24 | plt.legend(bbox_to_anchor = (1.45, 1), loc = 'upper right') 25 | plt.title('Pricing by Neighborhoods in Brooklyn from 2003 to 2017') 26 | plt.ylabel('Price Range') 27 | plt.xticks(fontsize = 6) 28 | -------------------------------------------------------------------------------- /Chapter18/ch18_pairplots.py: -------------------------------------------------------------------------------- 1 | import seaborn as sns 2 | import pandas as pd 3 | 4 | df = pd.read_csv('C:\\...\\Data_Cortex_Nuclear.csv') 5 | sns.pairplot(df, hue = 'Treatment') 6 | -------------------------------------------------------------------------------- /Chapter18/ch18_predictionsModel.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | %matplotlib inline 5 | from matplotlib.pylab import rcParams 6 | rcParams['figure.figsize']=20,10 7 | from keras.models import Sequential 8 | from keras.layers import LSTM,Dropout,Dense 9 | from sklearn.preprocessing import MinMaxScaler 10 | 11 | #Import your data files 12 | VZ = pd.read_csv('C:\\...\\VZ.csv') 13 | VZ.head() 14 | 15 | #Read and plot the data for Closing price over time 16 | VZ["Date"]=pd.to_datetime(VZ.Date,format="%Y-%m-%d") 17 | VZ.index=VZ['Date'] 18 | plt.figure(figsize=(16,8)) 19 | plt.plot(VZ["Close"],label='Close price history') 20 | plt.title('Closing price over time', fontsize = 20) 21 | plt.xlabel('Time', fontsize = 15) 22 | plt.ylabel('Closing price', fontsize = 15) 23 | plt.show() 24 | 25 | #Sorting data and creating training models 26 | data=VZ.sort_index(ascending=True,axis=0) 27 | VZ2=pd.DataFrame(index=range(0,len(VZ)),columns=['Date','Close']) 28 | for i in range(0,len(data)): 29 | VZ2["Date"][i]=data['Date'][i] 30 | VZ2["Close"][i]=data["Close"][i] 31 | 32 | VZ3=VZ2.values 33 | train_data=VZ3[0:7500,:] 34 | valid_data=VZ3[7500:,:] 35 | VZ2.index=VZ2.Date 36 | VZ2.drop("Date",axis=1,inplace=True) 37 | scaler=MinMaxScaler(feature_range=(0,1)) 38 | scaled_data=scaler.fit_transform(VZ2) 39 | x_train_data,y_train_data=[],[] 40 | for i in range(60,len(train_data)): 41 | x_train_data.append(scaled_data[i-60:i,0]) 42 | y_train_data.append(scaled_data[i,0]) 43 | 44 | x_train_data,y_train_data=np.array(x_train_data),np.array(y_train_data) 45 | x_train_data=np.reshape(x_train_data,(x_train_data.shape[0],x_train_data.shape[1],1)) 46 | 47 | #LSTM models 48 | lstm_model=Sequential() 49 | lstm_model.add(LSTM(units=50,return_sequences=True,input_shape=(x_train_data.shape[1],1))) 50 | lstm_model.add(LSTM(units=50)) 51 | lstm_model.add(Dense(1)) 52 | inputs_data=VZ2[len(VZ2)-len(valid_data)-60:].values 53 | inputs_data=inputs_data.reshape(-1,1) 54 | inputs_data=scaler.transform(inputs_data) 55 | lstm_model.compile(loss='mean_squared_error',optimizer='adam') 56 | lstm_model.fit(x_train_data,y_train_data,epochs=1,batch_size=1,verbose=2) 57 | 58 | X_test=[] 59 | for i in range(60,inputs_data.shape[0]): 60 | X_test.append(inputs_data[i-60:i,0]) 61 | X_test=np.array(X_test) 62 | X_test=np.reshape(X_test,(X_test.shape[0],X_test.shape[1],1)) 63 | predicted_closing_price=lstm_model.predict(X_test) 64 | predicted_closing_price=scaler.inverse_transform(predicted_closing_price) 65 | 66 | 67 | train_data=VZ2[:7500] 68 | valid_data=VZ2[7500:] 69 | valid_data['Predictions']=predicted_closing_price 70 | plt.plot(train_data["Close"]) 71 | plt.plot(valid_data[['Close',"Predictions"]]) 72 | plt.title('Closing price over time with prediction model', fontsize = 20) 73 | plt.xlabel('Time', fontsize = 15) 74 | plt.ylabel('Closing price', fontsize = 15) 75 | plt.show() 76 | -------------------------------------------------------------------------------- /Chapter18/ch18_stockAnalysis.py: -------------------------------------------------------------------------------- 1 | import quandl 2 | import numpy as np 3 | from sklearn.linear_model import LinearRegression 4 | from sklearn.svm import SVR 5 | from sklearn.model_selection import train_test_split 6 | 7 | #Get data from Quandl. Note that you'll need your own API to substitute in the api.key below. 8 | quandl.ApiConfig.api_key = '...' 9 | VZ = quandl.get('EOD/VZ') 10 | print(VZ.head()) 11 | 12 | #Grab the Adj_Close column 13 | VZ = VZ[['Adj_Close']] 14 | print(VZ.head()) 15 | -------------------------------------------------------------------------------- /Chapter18/ch18_tessellation.py: -------------------------------------------------------------------------------- 1 | import math 2 | import cmath 3 | import cairo 4 | 5 | #Define the configuration of the image. 6 | canvas_size = (500, 500) 7 | number_subdivisions = 4 8 | 9 | gr = (1 + math.sqrt(5)) / 2 #Golden Ratio 10 | 11 | def subdivide(triangles): 12 | result = [] 13 | for color, A, B, C in triangles: 14 | if color == 0: 15 | P = A + (B - A) / gr 16 | result.extend ([(0, C, P, B), (1, P, C, A)]) 17 | else: 18 | Q = B + (A - B) / gr 19 | R = B + (C - B) / gr 20 | result += [(1, R, C, A), (1, Q, R, B), (0, R, Q, A)] 21 | return result 22 | 23 | def setup_canvas(size): 24 | surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, size[0], 25 | size[1]) 26 | cr = cairo.Context(surface) 27 | cr.translate(size[0] / 2.0, size[1] / 2.0) 28 | wheel_radius = 1.2 * math.sqrt((size[0] / 2.0) ** 2 + 29 | (size[1] / 2.0) ** 2) 30 | cr.scale(wheel_radius, wheel_radius) 31 | return surface, cr 32 | 33 | def create_initial_triangles(): 34 | triangles = [] 35 | for i in range(10): 36 | B = cmath.rect(1, (2 * i - 1) * math.pi / 10) 37 | C = cmath.rect(1, (2 * i + 1) * math.pi / 10) 38 | if i % 2 == 0: 39 | B, C = C, B 40 | triangles.append((0, 0j, B, C)) 41 | return triangles 42 | 43 | def draw_triangles(cr, triangles, color_code, r, g, b): 44 | for color, A, B, C in triangles: 45 | if color == color_code: 46 | cr.move_to(A.real, A.imag) 47 | cr.line_to(B.real, B.imag) 48 | cr.line_to(C.real, C.imag) 49 | cr.close_path() 50 | cr.set_source_rgb(r, g, b) 51 | cr.fill() 52 | 53 | def draw_borders(cr, triangles): 54 | color, A, B, C = triangles[0] 55 | cr.set_line_width(abs(B - A) / 10.0) 56 | cr.set_line_join(cairo.LINE_JOIN_ROUND) 57 | for color, A, B, C in triangles: 58 | cr.move_to(C.real, C.imag) 59 | cr.line_to(A.real, A.imag) 60 | cr.line_to(B.real, B.imag) 61 | cr.set_source_rgb(0.3, 0.5, 0.3) 62 | cr.stroke() 63 | 64 | def save_image(surface, file_path): 65 | surface.write_to_png(file_path) 66 | # Main Execution 67 | triangles = create_initial_triangles() 68 | for _ in range(number_subdivisions): 69 | triangles = subdivide(triangles) 70 | surface, cr = setup_canvas(canvas_size) 71 | draw_triangles(cr, triangles, 0, .2, .8, .8) # teal triangles 72 | draw_triangles(cr, triangles, 1, 0.7, 0, 0.7) #purple triangles 73 | draw_borders(cr, triangles) #The Triangle borders 74 | save_image(surface, r'C:\\...\\tessellation.png') 75 | 76 | -------------------------------------------------------------------------------- /Chapter18/us-PuertoRico.csv: -------------------------------------------------------------------------------- 1 | date,state,fips,cases,deaths 2 | 10/1/2020,Puerto Rico,72,49067,665 3 | 10/2/2020,Puerto Rico,72,49747,673 4 | 10/3/2020,Puerto Rico,72,50375,681 5 | 10/4/2020,Puerto Rico,72,50675,686 6 | 10/5/2020,Puerto Rico,72,51305,695 7 | 10/6/2020,Puerto Rico,72,51737,696 8 | 10/7/2020,Puerto Rico,72,51768,705 9 | 10/8/2020,Puerto Rico,72,52294,715 10 | 10/9/2020,Puerto Rico,72,52892,720 11 | 10/10/2020,Puerto Rico,72,53364,728 12 | 10/11/2020,Puerto Rico,72,53671,730 13 | 10/12/2020,Puerto Rico,72,54234,735 14 | 10/13/2020,Puerto Rico,72,54540,738 15 | 10/14/2020,Puerto Rico,72,55516,742 16 | 10/15/2020,Puerto Rico,72,56085,743 17 | 10/16/2020,Puerto Rico,72,56412,758 18 | 10/17/2020,Puerto Rico,72,56650,761 19 | 10/18/2020,Puerto Rico,72,57293,766 20 | 10/19/2020,Puerto Rico,72,57950,768 21 | 10/20/2020,Puerto Rico,72,58643,769 22 | 10/21/2020,Puerto Rico,72,58830,774 23 | 10/22/2020,Puerto Rico,72,59037,783 24 | 10/23/2020,Puerto Rico,72,60984,791 25 | 10/24/2020,Puerto Rico,72,61280,794 26 | 10/25/2020,Puerto Rico,72,62503,801 27 | 10/26/2020,Puerto Rico,72,63135,804 28 | 10/27/2020,Puerto Rico,72,63497,808 29 | 10/28/2020,Puerto Rico,72,63587,813 30 | 10/29/2020,Puerto Rico,72,64798,814 31 | 10/30/2020,Puerto Rico,72,65743,820 32 | 10/31/2020,Puerto Rico,72,66128,822 33 | -------------------------------------------------------------------------------- /Chapter18_languageDetection.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import matplotlib.pyplot as plt 4 | from sklearn.model_selection import train_test_split 5 | from sklearn.pipeline import Pipeline 6 | from sklearn.naive_bayes import MultinomialNB 7 | from sklearn.feature_extraction.text import CountVectorizer 8 | from sklearn.metrics import confusion_matrix, classification_report 9 | 10 | # Load your dataset 11 | dataset_path = r'C:\Users\PATH_TO_FILE\dataset.csv' 12 | df = pd.read_csv(dataset_path) 13 | X = df['Text'] 14 | y = df['language'] 15 | 16 | # Splitting the dataset into training and testing sets 17 | X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) 18 | 19 | # Create a pipeline 20 | pipeline = Pipeline([ 21 | ('vectorizer', CountVectorizer()), 22 | ('classifier', MultinomialNB()) 23 | ]) 24 | 25 | # Train the model 26 | pipeline.fit(X_train, y_train) 27 | 28 | # Predictions 29 | y_pred = pipeline.predict(X_test) 30 | 31 | # Evaluate the model 32 | print(classification_report(y_test, y_pred)) 33 | conf_mat = confusion_matrix(y_test, y_pred) 34 | 35 | # Plot confusion matrix 36 | plt.figure(figsize=(10,10)) 37 | plt.imshow(conf_mat, interpolation='nearest', cmap=plt.cm.Blues) 38 | plt.title('Confusion Matrix') 39 | plt.colorbar() 40 | tick_marks = np.arange(len(y.unique())) 41 | plt.xticks(tick_marks, y.unique(), rotation=45) 42 | plt.yticks(tick_marks, y.unique()) 43 | plt.tight_layout() 44 | plt.ylabel('True label') 45 | plt.xlabel('Predicted label') 46 | plt.show() 47 | 48 | -------------------------------------------------------------------------------- /Chapter19/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Applied Computational Thinking with Python 2 | 3 | no-image 4 | 5 | This is the code repository for [Applied Computational Thinking with Python](https://www.packtpub.com/product/applied-computational-thinking-with-python-second-edition/9781837632305), published by Packt. 6 | 7 | **Algorithm design for complex real-world problems** 8 | 9 | ## What is this book about? 10 | Applied Computational Thinking with Python provides a hands-on approach to implementation and associated methodologies that will have you up-and-running, and productive in no time. Developers working with Python will be able to put their knowledge to work with this practical guide using the computational thinking method for problem-solving. 11 | 12 | This book covers the following exciting features: 13 | 14 | * Find out how to use decomposition to solve problems through visual representation 15 | * Employ pattern generalization and abstraction to design solutions 16 | * Build analytical skills to assess algorithmic solutions 17 | * Use computational thinking with Python for statistical analysis 18 | * Understand the input and output needs for designing algorithmic solutions 19 | * Use computational thinking to solve data processing problems 20 | * Identify errors in logical processing to refine your solution design 21 | * Apply computational thinking in domains, such as cryptography, and machine learning 22 | 23 | If you feel this book is for you, get your [copy](https://www.amazon.com/Applied-Computational-Thinking-Python-real-world/dp/1837632308/ref=sr_1_4?crid=3JZRXWA9SVTEM&keywords=applied+computational+thinking+with+python&qid=1704196126&sprefix=%2Caps%2C266&sr=8-4) today! 24 | 25 | ## Instructions and Navigations 26 | All of the code is organized into folders. For example, Chapter02. 27 | 28 | The code will look like the following: 29 | 30 | ``` 31 | def encrypt(message, key): 32 | encryptedM = ‘’ 33 | for letts in message: 34 | if letts in LETTERS: 35 | num = LETTERS.find(letts) 36 | num += key 37 | encryptedM += LETTERS[num] 38 | return encryptedM 39 | ``` 40 | 41 | **Following is what you need for this book:** 42 | This book is for students, developers, and professionals looking to develop problem-solving skills and tactics involved in writing or debugging software programs and applications. Familiarity with Python programming is required. 43 | 44 | With the following software and hardware list you can run all code files present in the book (Chapter 1-19). 45 | ### Software and Hardware List 46 | | Chapter | Software required | OS required | 47 | | -------- | ------------------------------------ | ----------------------------------- | 48 | | 1-19 | Python 3.X | Windows, macOS X, or Linux | 49 | 50 | ### Related products 51 | * Advanced Python Programming [[Packt]](https://www.packtpub.com/product/advanced-python-programming-second-edition/9781801814010) [[Amazon]](https://www.amazon.com/Advanced-Python-Programming-Accelerate-techniques/dp/1801814015/ref=sr_1_1?crid=WZ923V16OZ5Y&keywords=advanced+python+programming&qid=1703787274&sprefix=advanced+python+prograaming%2Caps%2C329&sr=8-1) 52 | 53 | * Python Real-World Projects [[Packt]](https://www.packtpub.com/product/python-real-world-projects/9781803246765) [[Amazon]](https://www.amazon.com/Python-Real-World-Projects-deployable-applications/dp/1803246766/ref=sr_1_1?crid=1A2IAY06FA4AK&keywords=python+real-world+projects&qid=1703787308&sprefix=python+real-wo%2Caps%2C302&sr=8-1) 54 | 55 | ## Get to Know the Author 56 | **Sofía De Jesús** 57 | is an educator with over 20 years of experience in industry and in the classroom, creating computational thinking and STEM programs and working in curriculum design and development in multiple areas, including mathematics, computational thinking, programming, computer science, and more. Sofía received her bachelor's degree from the University of Puerto Rico with a focus on mathematics. She has a master's degree from the University of Dayton. She also completed 60+ credits towards an EdD. Sofía has worked with clients to develop solutions in multiple programming languages. As a teacher, Sofía helped students incorporate the philosophy of computational thinking in courses like game design, circuits, Python, web design, and robotics. Sofía likes to play video games and enjoys creating materials, small furniture, and jewelry using CNC machines and laser cutters. Sofía enjoys spending as much time in Puerto Rico as work and life permits 58 | 59 | **Dayrene Martinez** 60 | is a Systems Engineer in the Defense Industry where she develops neural networks embedded in real-time software to aid in decision making for aerospace vehicles. She received a B.S. in Electrical Engineering from the New Jersey Institute of Technology (NJIT). Dayrene is passionate about STEM education and volunteers her free time to inspire the next generation of engineers. She is an active supporter and keynote speaker for the non-profit organization Latinas in STEM. Dayrene teaches middle and high school students circuitry, robotics design and software engineering. 61 | --------------------------------------------------------------------------------