From 62999b90926b22a56b9b8e47bbed556bbd8410bb Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 1 Nov 2017 08:46:54 -0500 Subject: [PATCH 01/27] part of worksheet 1 finished --- Worksheets/worksheet_01.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Worksheets/worksheet_01.txt b/Worksheets/worksheet_01.txt index 728ad02..b509926 100644 --- a/Worksheets/worksheet_01.txt +++ b/Worksheets/worksheet_01.txt @@ -6,22 +6,27 @@ and punctuation. Please limit the length of each line to 80 characters. 1. Write a line of code that will print your name. + print(Bethany DuMontelle) 2. How do you enter a comment in a program? + Use a # 3. What do the following lines of code output? ALSO: Why do they give a different answer? print(2 / 3) print(2 // 3) + The first line prints 0.6666666666666666, while the other code prints 0. This is because the first code is division, while the other one is floor division. 4. Write a line of code that creates a variable called pi and sets it to an appropriate value. + pi = 3.141592654 5. Why does this code not work? A = 22 print(a) + It tries to print out a lowercase a, which is different from an uppercase A. 6. All of the variable names below can be used. But which ONE of these is the better variable name to use? @@ -34,6 +39,8 @@ area_of_rectangle Area_Of_Rectangle + area_of_rectange is the best name to use. + 7. Which of these variables names are not allowed in Python? (More than one might be wrong. Also, this question is not asking about improper names, just names that aren't allowed. Test them if you aren't sure.) @@ -61,15 +68,21 @@ total% #left + account number, 1Apple, 2x, and #left are not allowed. + 8. Why does this code not work? print(a) a = 45 + a needs to be established before it is printed. + 9. Explain the mistake in this code: pi = float(3.14) + float is used for floating point numbers, int needs to be used for integers. + 10. This program runs, but the code still could be better. Explain what is wrong with the code. From ff0d6b338a3de11a8b182399e75594d5c4c63bd9 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 1 Nov 2017 09:04:20 -0500 Subject: [PATCH 02/27] Finished worksheet 1 --- Worksheets/worksheet_01.txt | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Worksheets/worksheet_01.txt b/Worksheets/worksheet_01.txt index b509926..88fc780 100644 --- a/Worksheets/worksheet_01.txt +++ b/Worksheets/worksheet_01.txt @@ -92,6 +92,8 @@ area = pi * radius ** 2 print(area) + The variables should be more specific. + 11. Explain the mistake in the following code: x = 4 @@ -99,6 +101,8 @@ a = ((x) * (y)) print(a) + x and y need to be integers with int. + 12. Explain the mistake in the following code: x = 4 @@ -106,53 +110,77 @@ a = 3(x + y) print(a) + int is needed. + 13. Explain the mistake in the following code: radius = input(float("Enter the radius:")) + float needs to be before input, not the other way around. + 14. Do all these print the same value? Which one is better to use and why? print(2/3+4) print(2 / 3 + 4) print( 2 / 3+ 4 ) + The 2nd one is the best because it looks nice than the 1st and 3rd one, and is more accepted to do it that way. + 15. What is a constant? + + A variable that does not change. 16. How are variable names for constants different than other variable names? + + The variable name needs to be in all caps. 17. What is a single quote and what is a double quote? Give and label an example of both. + + 'Single quote' + "Double quote" 18. Write a Python program that will use escape codes to print a double-quote and a new line using the Window's standard. (Note: I'm asking for the Window's standard here. Look it up out of Chapter 1.) - + + "Here is a sentence with a /" in it." + 19. Can a Python program print text to the screen using single quotes instead of double quotes? + Of course + 20. Why does this code not calculate the average? print(3 + 4 + 5 / 3) + The program tries to divide 5 by 3, then add everything together. + 21. What is an ``operator'' in Python? + A symbol that makes the program do a mathmatical equation. + 22. What does the following program print out? x = 3 x + 1 print(x) + The program prints out 3. 23. Correct the following code: user_name = input("Enter your name: )" + user_name = input("Enter your name: ") 24. Correct the following code: value = int(input(print("Enter your age"))) - + value = int(input("Enter your age")) + print(value) From be67cb756e656beb580f4485a1b208d02ebcd232 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 1 Nov 2017 09:14:31 -0500 Subject: [PATCH 03/27] Completed lab A Chapter 1 --- Lab 01 - Calculator/lab_01_part_a.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lab 01 - Calculator/lab_01_part_a.py b/Lab 01 - Calculator/lab_01_part_a.py index 792d600..0f6bd83 100644 --- a/Lab 01 - Calculator/lab_01_part_a.py +++ b/Lab 01 - Calculator/lab_01_part_a.py @@ -1 +1,8 @@ -# +#!/usr/bin/env python3 +# 1.1 Lab Part A +# Bethany DuMontelle +#1 November 2017 + +fahrenheit_temp = int(input('Enter temperature in Fahrenheit: ')) +celsius_temp = ( ((fahrenheit_temp) - 32) / 1.8 ) +print(celsius_temp) From 6b47689cdca4b765f0a155846d45de6cb3fc5bf9 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 1 Nov 2017 10:14:29 -0500 Subject: [PATCH 04/27] Trying to do lab b --- Lab 01 - Calculator/lab_01_part_b.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Lab 01 - Calculator/lab_01_part_b.py b/Lab 01 - Calculator/lab_01_part_b.py index 792d600..fcd907d 100644 --- a/Lab 01 - Calculator/lab_01_part_b.py +++ b/Lab 01 - Calculator/lab_01_part_b.py @@ -1 +1,13 @@ -# +#!/usr/bin/env python3 +# Lab B Chapter 1 +#Bethany DuMontelle +#1 November 2017 + +print('Area of a trapezoid') +trap_height = int(input("Enter the height of the trapezoid: ")) +trap_bbase = int(input('Enter the ength of the bottom base: ')) +trap_tbase = int(input('Enter the length of the top base: ')) + +trap_area = 1/2(( (trap_bbase) + (trap_tbase) ) * (trap_height)) + +print(str(trap_area)) \ No newline at end of file From b3c7bc21ef621d5e0f997e9d0d840e2016f671bd Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Thu, 2 Nov 2017 07:36:43 -0500 Subject: [PATCH 05/27] Finished Lab B --- Lab 01 - Calculator/lab_01_part_b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lab 01 - Calculator/lab_01_part_b.py b/Lab 01 - Calculator/lab_01_part_b.py index fcd907d..c368c66 100644 --- a/Lab 01 - Calculator/lab_01_part_b.py +++ b/Lab 01 - Calculator/lab_01_part_b.py @@ -8,6 +8,6 @@ trap_bbase = int(input('Enter the ength of the bottom base: ')) trap_tbase = int(input('Enter the length of the top base: ')) -trap_area = 1/2(( (trap_bbase) + (trap_tbase) ) * (trap_height)) +trap_area = 1/2 * (( (trap_bbase) + (trap_tbase) ) * (trap_height)) print(str(trap_area)) \ No newline at end of file From d824f06e5b27fe1b2c2891384219f954fed41201 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Thu, 2 Nov 2017 07:53:19 -0500 Subject: [PATCH 06/27] Finished chapter 1 lab c --- Lab 01 - Calculator/lab_01_part_c.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Lab 01 - Calculator/lab_01_part_c.py b/Lab 01 - Calculator/lab_01_part_c.py index 792d600..ce6578f 100644 --- a/Lab 01 - Calculator/lab_01_part_c.py +++ b/Lab 01 - Calculator/lab_01_part_c.py @@ -1 +1,14 @@ -# +#!/usr/bin/env python3 +#Chapter 1 Lab Part C +#Bethany DuMontelle +#2 November 2017 + +PI = int(3.141592654) + +print('Area of a circle') + +circle_radius = int(input('What is the radius of the circle? ')) + +circle_area = ( (PI) * (circle_radius) ** 2 ) + +print(circle_area) \ No newline at end of file From 266bb08e388cd8a54cd948e1f4147b50fdb2c81f Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Thu, 2 Nov 2017 09:12:14 -0500 Subject: [PATCH 07/27] Completed chapter 2 worksheet --- Worksheets/worksheet_02.txt | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Worksheets/worksheet_02.txt b/Worksheets/worksheet_02.txt index abe4cd7..7239ecd 100644 --- a/Worksheets/worksheet_02.txt +++ b/Worksheets/worksheet_02.txt @@ -7,36 +7,67 @@ binary, decimal, and hexadecimal number, try coming up with an example that better illustrates the differences between the different bases of numbers.) + 1011 0001 1101 + 2. Give an example of a decimal number. + + 56 3. Give an example of a hexadecimal number. + + F7C6 4. Convert the numbers 1, 10, 100, 1000, and 10000 from binary to decimal. + + 1, 2, 4, 8, 16 5. What is a compiler? + Takes the program written and converts it to machine code. + 6. What is source code? + + The code that is typed by a user. 7. What is machine language? (Don't just say binary. That's not correct.) + + Machine language uses the same system as binary code does, and can not only use it to interpret commands, but also to store data, like documents. 8. What is a first generation language? (Don't just say binary. That's not correct.) + + A first generation language is where a number represents data or instructions for a computer to perform. 9. What is a second generation language? + + Assembly language 10. What is a third generation language? (Explain, don't just give one example.) + + Program languages that uses logic to make certain commands perform, such as python, COBOL, and C#. 11. What is an interpreter and how does it differ from a compiler? + + An interpreter directly translates source code into machine code, while a compiler takes it and turns it into machine code. 12. Search the web and find some of the most popular programming languages. List the website(s) you got the information from and what the languages are. + + java, python, C#, Ruby, JavaScript, C,PHP, Objective-C, SQL + https://www.inc.com/larry-kim/10-most-popular-programming-languages-today.html 13. Look at the job boards and see what languages people are looking for. List the languages and the job board you looked at. + The most common languages people are looking for when hiring are python, c+, and java. + https://stackoverflow.com/jobs + 14. What is the difference between the ``syntax'' and ``semantics'' of a language? + Syntax is the code structure, while semantics is the meaning of the symbols and words. + 15. Pick a piece of technology, other than a computer you use regularly. Briefly describe the hardware and software that run on it. - + A piece of technology I commonly use is my new 3ds. It has duel screens, with the bottom screen being a touch-screen. The top screen is able to go in 3d, thus the name. + It also connects to the intenet and you can download games from their shop in the console. From 919003656c3979b1f94188099f6a13ebe2f4e44e Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Thu, 2 Nov 2017 10:11:05 -0500 Subject: [PATCH 08/27] Started worksheet of chapter 3 --- Worksheets/worksheet_03.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Worksheets/worksheet_03.txt b/Worksheets/worksheet_03.txt index bc85b84..5280979 100644 --- a/Worksheets/worksheet_03.txt +++ b/Worksheets/worksheet_03.txt @@ -10,13 +10,27 @@ print("It is hot outside.") else: print("It is not hot out.") + + quotes need to go around 90. 2. Write a Python program that will take in a number from the user and print if it is positive, negative, or zero. Use a proper if/elif/else chain, don't just use three if statements. + + user_number = int(input('Enter a number: ')) + if user_number == '0': + print('Your number is 0.') + elif user_number < '0': + print('Your number is negative.') + else: + print('Your number is positive.') 3. Write a Python program that will take in a number from a user and print out ``Success'' if it is greater than -10 and less than 10, inclusive. (1 pt) + + user_number = int(input('Enter a number: ')) + if user_number >= -10 and user_number <= 10: + print('Success') 4. This runs, but there is something wrong. What is it? (1 pt) @@ -27,6 +41,8 @@ print("Correct!") else: print("Incorrect.") + + The print statements need to be before the user input, or else they won't know their choices. 5. There are two things wrong with this code that tests if x is set to a positive value. One prevents it from running, and the other is subtle. @@ -38,6 +54,8 @@ print("x is positive.") else: print("x is not positive.") + + 0 should not be included, as it is not positive or negative. The other issue is that 6. What three things are wrong with the following code? (3 pts) From fea9ca6c31ae421d0ffcc2ac2bf210e6c96834a5 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Fri, 3 Nov 2017 08:17:21 -0500 Subject: [PATCH 09/27] finished worksheet 3 chapter 3 --- Worksheets/worksheet_03.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Worksheets/worksheet_03.txt b/Worksheets/worksheet_03.txt index 5280979..ef193fa 100644 --- a/Worksheets/worksheet_03.txt +++ b/Worksheets/worksheet_03.txt @@ -55,13 +55,15 @@ else: print("x is not positive.") - 0 should not be included, as it is not positive or negative. The other issue is that + 0 should not be included, as it is not positive or negative. The other issue is that there should only be one = when defining x as 4. 6. What three things are wrong with the following code? (3 pts) x = input("Enter a number: ") if x = 3 print("You entered 3") + + The if statement needs to have 2 = signs for it to work, a : is needed after the if statement, and the print statement does not work. 7. There are four things wrong with this code. Identify all four issues. (4 pts) @@ -70,12 +72,16 @@ print("Correct!") else print("Incorrect! It is Beaker.") + + else should not be indented and needs a :, a needs to be answer or answer needs to be a, and there needs to be 2 = instead of one. 8. This program doesn't work correctly. What is wrong? (1 pt) x = input("How are you today?") if x == "Happy" or "Glad": print("That is good to hear!") + + x needs to be defined as equal to Glad(x == "Happy" or x == "Glad") 9. Look at the code below. Write you best guess here on what it will print. Next, run the code and see if you are correct. @@ -96,6 +102,9 @@ print("Fizz") if z: print("Buzz") + + My guess: Fizz + Actual output: Buzz 10. Look at the code below. Write you best guess on what it will print. Next, run the code and see if you are correct. (2 pts) @@ -115,6 +124,9 @@ print(x == 5 and y == 5) print(x == 5 or y == 5) + My guess: true, false, true, false, false, true, false, true, false, true + Actual output: true, false, true, flase, flase, true, false, true, false, true + 11. Look at the code below. Write you best guess on what it will print. Next, run the code and see if you are correct. (2 pts) @@ -128,6 +140,9 @@ print( (2 == 2) == True ) print(3 < "3") + My guess: true, false, true, true, true, true, false, true, false + Actual output: true, false, true, true, true, flase, false, true, int str error + 12. What things are wrong with this section of code? The programmer wants to set the money variable according to @@ -147,6 +162,8 @@ money = 70 else if user_input = C: money = 50 + + there should be 2 = signs and A, B, and C should be in quotes. From 71207a9c52b8bbc713e0147675da2024966378e8 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Fri, 3 Nov 2017 09:06:05 -0500 Subject: [PATCH 10/27] did lab 3 of chapter 3 --- Lab 03 - Create a Quiz/main_program.py | 84 +++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/Lab 03 - Create a Quiz/main_program.py b/Lab 03 - Create a Quiz/main_program.py index 792d600..ec633a4 100644 --- a/Lab 03 - Create a Quiz/main_program.py +++ b/Lab 03 - Create a Quiz/main_program.py @@ -1 +1,83 @@ -# +#!/usr/bin/env python3 +#Chapter 3 quiz +#Bethany DuMontelle +#3 November 2017 + +print('Time for a quiz! Are you ready?') +print() + +#Sets up score +score = int(0) + +#q1 +question_one = int(input('How many pokemon are there as of \ +2017, not including other forms? ')) + +if question_one == 802: + score = score + 1 + print('Correct!') +else: + print('Incorrect! There are currently 802 pokemon.') +print() + +#q2 +print("What does pikachu's shiny look like?") +print('A. Blue') +print('B. Light yellow') +print('C. Dark yellow') +question_two = input() +if question_two.lower() == 'c': + score = score + 1 + print('Correct!') +else: + print('Incorrect! Pikachu is dark yellow when shiny.') +print() + +#q3 +print('Which of these pokemon are considered to have the worst shiny of \ +all time?') +print('A. Pikachu') +print('B. Garchomp') +print('C. Charizard') +question_three = input() +if question_three.lower() == 'b': + score = score + 1 + print('Correct!') +else: + print('Incorrect! Garchomp is thought to have the worst shiny ever.') +print() + +#q4 +print('As of generation 6, what are the odds of finding a shiny pokemon? ') +question_four = int(input('1 in ')) +if question_four == 4096: + score = score + 1 + print('Correct!') +elif question_four == 8192: + print('Wrong generation! It is now 1 in 4096.') +else: + print('Incorrect! The odds are 1 in 4096.') +print() + +#q5 +print('True or false: pokemon can change their shinies when mega-evolved.') +question_five = input() +if question_five.lower() == 'true': + score = score + 1 + print('Correct!') +else: + print('Incorrect! Some do change their shinies when mega-evolved.') +print() + +#results +percent = (int(score) / 5) * 100 +print('Your total score is', str(score) + ' out of 5.') +print('This is also ' + str(percent) + ' percent.') +if score == 0 or score == 1: + print('You didn\'t do very well.') +elif score == 2 or score == 3: + print('Not very good, but not that bad either.') +elif score == 4: + print('Pretty good!') +else: + print('You did fantastic!') \ No newline at end of file From ecd461cbac092a65d75b65375afb602fbaa2d9c1 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Fri, 3 Nov 2017 10:11:51 -0500 Subject: [PATCH 11/27] did part of chapter 4 worksheet --- Lab 04 - Camel/main_program.py | 11 ++++++++++- Worksheets/worksheet_04.txt | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Lab 04 - Camel/main_program.py b/Lab 04 - Camel/main_program.py index 792d600..47db4ff 100644 --- a/Lab 04 - Camel/main_program.py +++ b/Lab 04 - Camel/main_program.py @@ -1 +1,10 @@ -# +#!/usr/bin/env python3 +#Lab 4 chapter 4 Camel +#Bethany DuMontelle +#3 November 2017 + +Miles_left = 100 +Natives_range = 125 +thrist = 6 +canteen = 5 +camel_rest = 8 diff --git a/Worksheets/worksheet_04.txt b/Worksheets/worksheet_04.txt index 341b2fa..34d0fe5 100644 --- a/Worksheets/worksheet_04.txt +++ b/Worksheets/worksheet_04.txt @@ -13,17 +13,34 @@ 1. Write a Python program that will use a for loop to print your name 10 times, and then the word ``Done'' at the end. + + user_name = input('Enter your name: ') + for i in range(10): + print(user_name) 2. Write a Python program that will use a for loop to print ``Red'' and then ``Gold'' 20 times. (Red Gold Red Gold Red Gold... all on separate lines. Don't use \n.) + + for i in range(10): + print('red') + print('gold') 3. Write a Python program that will use a for loop to print the even numbers from 2 to 100, inclusive. + + for i in range(2, 101): + print(i) 4. Write a Python program that will use a while loop to count from 10 down to, and including, 0. Then print the words ``Blast off!'' Remember, use a WHILE loop, don't use a FOR loop. + + countdown = 10 + while countdown != -1: + print(countdown) + countdown = countdown - 1 + print('Blastoff!') 5. There are three things wrong with this program. List each. (3 pts) @@ -35,11 +52,17 @@ total = total + i print("The total is:", x) + x in print needs to be str, the user input should be before the loop, and there is no way to end the loop while it's running. + 6. Write a program that prints a random integer from 1 to 10 (inclusive). + + 7. Write a program that prints a random floating point number somewhere between 1 and 10 (inclusive). Do not make the mistake of generating a random number from 0 to 10 instead of 1 to 10. + + 8. Write a Python program that will: (3 pts) From 5e4375d5b79932f09c8f644e1399ed5922f1355c Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Mon, 6 Nov 2017 10:12:51 -0600 Subject: [PATCH 12/27] almost finished lab 4 and worksheet 4 --- Lab 04 - Camel/main_program.py | 115 +++++++++++++++++++++++++++++++-- Worksheets/worksheet_04.txt | 99 +++++++++++++++++++++++++++- 2 files changed, 208 insertions(+), 6 deletions(-) diff --git a/Lab 04 - Camel/main_program.py b/Lab 04 - Camel/main_program.py index 47db4ff..a732ae7 100644 --- a/Lab 04 - Camel/main_program.py +++ b/Lab 04 - Camel/main_program.py @@ -3,8 +3,115 @@ #Bethany DuMontelle #3 November 2017 -Miles_left = 100 -Natives_range = 125 -thrist = 6 +from random import randint + +miles_left = 1000 +natives_range = 1025 +user_thirst = 6 canteen = 5 -camel_rest = 8 +camel_rest = 10 +done = False + +print('Welcome to Camel!') +print('You have stolen a camel to make your way across the Great Mobi desert.') +print('The natives want their camel back and are chasing you down! Survive') +print('your desert trek and out run the natives.') + +while done != True: + + native_close = (natives_range) - (miles_left) + + oasis = randint(1,20) + + print('You are', str(miles_left), 'miles from crossing the Mobi dessert.') + + if native_close > 0 and native_close < 20: + print('The natives are only', str(native_close), 'miles from you!') + else: + print('The Natives are', str(native_close), 'miles away from you.') + + print('You have', str(canteen), 'drinks left in your canteen.') + + if user_thirst <= 2: + print('You are getting thirsty!') + + if camel_rest <= 2: + print('The camel is getting tired!') + + + print('What would you like to do?') + print('A. Drink from your canteen') + print('B. Ahead moderate speed.') + print('C. Ahead full speed.') + print('D. Stop for the night.') + print('E. Status check.') + print('Q. Quit') + + user_choice = input() + + if user_choice.lower() == 'a': + if canteen <= 0: + print('You don\'t have any more water!') + else: + user_thirst = user_thirst + 1 + canteen = canteen - 1 + + elif user_choice.lower() == 'b': + miles_move = randint(11,29) + miles_left = (miles_left) - (miles_move) + natives_move = randint(15,24) + natives_range = (natives_range) - (natives_move) + camel_rest = (camel_rest) - 1 + user_thirst = user_thirst - 1 + print('You moved', + (miles_move), 'miles.') + if oasis == 1: + canteen_fill = randint(2,5) + print('You found an oasis!') + print('You can now drink', (canteen_fill), 'more times.') + + elif user_choice.lower() == 'c': + miles_move = randint(25,36) + miles_left = (miles_left) - (miles_move) + natives_move = randint(15,24) + natives_range = (natives_range) - (natives_move) + camel_rest = (camel_rest) - 2 + user_thirst = user_thirst - 1 + print('You moved', + (miles_move), 'miles.') + if oasis == 1: + canteen_fill = randint(2,5) + print('You found an oasis!') + print('You can now drink', (canteen_fill), 'more times.') + + elif user_choice.lower() == 'd': + camel_shleep = randint(4,10) + camel_rest = (camel_rest) + (camel_shleep) + natives_move = randint(15,20) + natives_range = (natives_range) - (natives_move) + print('The camel is happy.') + + elif user_choice.lower() == 'e': + print('Miles left:', str(miles_left)) + print('Native distance:', str(natives_range)) + print('Canteen drinks:', str(canteen)) + print('Your thirst:', str(user_thirst)) + print('Camel rest level:', str(camel_rest)) + + elif user_choice.lower() == 'q': + print('You gave up. Your family is disappointed in you.') + done = True + + if miles_left <= 0: + print('You made it across the Mobi desert! Congradulations!') + done = True + + if user_thirst <= 0: + print('You died of thirst! Game over!') + done = True + + if camel_rest <= 0: + print('Your camel died! Game over!') + done = True + + if native_close <= 0: + print('The Natives got you! Game over!') + done = True \ No newline at end of file diff --git a/Worksheets/worksheet_04.txt b/Worksheets/worksheet_04.txt index 34d0fe5..d4299f7 100644 --- a/Worksheets/worksheet_04.txt +++ b/Worksheets/worksheet_04.txt @@ -56,13 +56,14 @@ 6. Write a program that prints a random integer from 1 to 10 (inclusive). - + from random import randint +print(randint(1,10)) 7. Write a program that prints a random floating point number somewhere between 1 and 10 (inclusive). Do not make the mistake of generating a random number from 0 to 10 instead of 1 to 10. - +????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 8. Write a Python program that will: (3 pts) @@ -72,6 +73,73 @@ and the number of negative entries. Use an if, elif, else chain, not just three if statements. + num_1 = int(input('Print a number: ')) +num_2 = int(input('Print a number: ')) +num_3 = int(input('Print a number: ')) +num_4 = int(input('Print a number: ')) +num_5 = int(input('Print a number: ')) +num_6 = int(input('Print a number: ')) +num_7 = int(input('Print a number: ')) + +zero = 0 +negative = 0 +positive = 0 + +print( (num_1) + (num_2) + (num_3) + (num_4) + (num_5) + (num_6) + (num_7) ) + +if num_1 < 0: + negative = negative + 1 +elif num_1 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_2 < 0: + negative = negative + 1 +elif num_2 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_3 < 0: + negative = negative + 1 +elif num_3 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_4 < 0: + negative = negative + 1 +elif num_4 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_5 < 0: + negative = negative + 1 +elif num_5 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_6 < 0: + negative = negative + 1 +elif num_6 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +if num_7 < 0: + negative = negative + 1 +elif num_7 > 0: + positive = positive + 1 +else: + zero = zero + 1 + +print('Zero: ' + str(zero)) +print('Positive: ' + str(positive)) +print('Negative: ' + str(negative)) + 9. Coin flip tosser: (4 pts) * Create a program that will print a random 0 or 1. @@ -80,6 +148,13 @@ * Add a loop so that the program does this 50 times. * Create a running total for the number of heads flipped, and the number of tails. + from random import randint +random_number = (randint(0,1)) +if random_number == 0: + print('Heads') +else: + print('Tails') + 10. Write a program that plays rock, paper, scissors: (4 pts) * Create a program that randomly prints 0, 1, or 2. @@ -89,4 +164,24 @@ * (It will be easier if you have them enter 1, 2, or 3.) * Add conditional statement to figure out who wins. + from random import randint +opponent_number = (randint(0,2)) + +player = input('Rock, Paper, or Scissors? ') + +if player.lower() == 'rock': + player_number = 0 +elif player.lower() == 'paper': + player_number = 1 +elif player.lower() == 'scissors': + player_number = 2 + +if player_number == 0 and opponent_number == 1 or player_number == 1 and\ +opponent_number == 2 or player_number == 2 and opponent_number == 0: + print('You lost!') +elif player_number == 0 and opponent_number == 2 or player_number == 1 and\ +opponent_number == 0 or player_number == 2 and opponent_number == 1: + print('You won!') +else: + print('Tie!') From 64be215a162885bd479f6983124b89d30c597ca7 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 7 Nov 2017 08:43:46 -0600 Subject: [PATCH 13/27] completed chapter 4 --- Lab 04 - Camel/main_program.py | 107 ++++++++++++++++++++------------- Worksheets/worksheet_04.txt | 3 +- 2 files changed, 66 insertions(+), 44 deletions(-) diff --git a/Lab 04 - Camel/main_program.py b/Lab 04 - Camel/main_program.py index a732ae7..a62b403 100644 --- a/Lab 04 - Camel/main_program.py +++ b/Lab 04 - Camel/main_program.py @@ -5,37 +5,42 @@ from random import randint -miles_left = 1000 -natives_range = 1025 -user_thirst = 6 -canteen = 5 -camel_rest = 10 +#sets up the variables needed +miles_left = 0 +natives_range = -20 +user_thirst = 0 +canteen = 3 +camel_rest = 0 done = False +#Introduces the player print('Welcome to Camel!') print('You have stolen a camel to make your way across the Great Mobi desert.') print('The natives want their camel back and are chasing you down! Survive') print('your desert trek and out run the natives.') +#begins the loop while done != True: + #tells the player how close they are, stops negative numbers from showing + native_close = (miles_left) - (natives_range) - native_close = (natives_range) - (miles_left) - - oasis = randint(1,20) + #sets up if an oasis can be found every time the loop starts over + oasis = randint(1,15) - print('You are', str(miles_left), 'miles from crossing the Mobi dessert.') + #tells the player important information + print('You have traveled', str(miles_left), 'miles.') - if native_close > 0 and native_close < 20: - print('The natives are only', str(native_close), 'miles from you!') + if native_close < 15: + print('The natives getting close!') else: print('The Natives are', str(native_close), 'miles away from you.') print('You have', str(canteen), 'drinks left in your canteen.') - if user_thirst <= 2: - print('You are getting thirsty!') + if user_thirst >= 4: + print('You are thirsty!') - if camel_rest <= 2: + if camel_rest >= 5: print('The camel is getting tired!') @@ -49,69 +54,85 @@ user_choice = input() + #allows the player to drink from their canteen + #also prevents players from drinking water they don't have if user_choice.lower() == 'a': if canteen <= 0: print('You don\'t have any more water!') else: - user_thirst = user_thirst + 1 + user_thirst = user_thirst - 1 canteen = canteen - 1 + #moves the player, also can find an oasis if the random number was 1 elif user_choice.lower() == 'b': - miles_move = randint(11,29) - miles_left = (miles_left) - (miles_move) - natives_move = randint(15,24) - natives_range = (natives_range) - (natives_move) - camel_rest = (camel_rest) - 1 - user_thirst = user_thirst - 1 + miles_move = randint(5,12) + miles_left = (miles_left) + (miles_move) + natives_move = randint(7,14) + natives_range = (natives_range) + (natives_move) + camel_rest = (camel_rest) + 1 + user_thirst = user_thirst + 1 print('You moved', + (miles_move), 'miles.') if oasis == 1: canteen_fill = randint(2,5) + canteen = (canteen) + (canteen_fill) + user_thirst = user_thirst + 2 print('You found an oasis!') print('You can now drink', (canteen_fill), 'more times.') - + + #also moves the player, but with more random elements and an oasis can + #be found as well elif user_choice.lower() == 'c': - miles_move = randint(25,36) - miles_left = (miles_left) - (miles_move) - natives_move = randint(15,24) - natives_range = (natives_range) - (natives_move) - camel_rest = (camel_rest) - 2 - user_thirst = user_thirst - 1 + miles_move = randint(10,20) + miles_left = (miles_left) + (miles_move) + natives_move = randint(7,14) + natives_range = (natives_range) + (natives_move) + camel_tired = randint(1,3) + camel_rest = (camel_rest) + (camel_tired) + user_thirst = user_thirst + 1 print('You moved', + (miles_move), 'miles.') if oasis == 1: canteen_fill = randint(2,5) + canteen = (canteen) + (canteen_fill) + user_thirst = user_thirst + 2 print('You found an oasis!') print('You can now drink', (canteen_fill), 'more times.') + #sets camel_rest to 0, moves the natives up as well elif user_choice.lower() == 'd': - camel_shleep = randint(4,10) - camel_rest = (camel_rest) + (camel_shleep) - natives_move = randint(15,20) - natives_range = (natives_range) - (natives_move) + camel_rest = 0 + natives_move = randint(7,14) + natives_range = (natives_range) + (natives_move) print('The camel is happy.') + #gives the player more stats elif user_choice.lower() == 'e': - print('Miles left:', str(miles_left)) - print('Native distance:', str(natives_range)) + print('Miles left:', 200 - (miles_left)) + print('Native distance:', (native_close)) print('Canteen drinks:', str(canteen)) - print('Your thirst:', str(user_thirst)) - print('Camel rest level:', str(camel_rest)) + print('Days until water is needed:', 6 - (user_thirst)) + print('Camel tiredness:', (camel_rest), 'out of 8') + #ends the game elif user_choice.lower() == 'q': print('You gave up. Your family is disappointed in you.') done = True - if miles_left <= 0: + #winning conditon + if miles_left >= 200: print('You made it across the Mobi desert! Congradulations!') done = True - - if user_thirst <= 0: + + #way to lose + if user_thirst >= 6: print('You died of thirst! Game over!') done = True - - if camel_rest <= 0: + + #another way to lose + if camel_rest >= 8: print('Your camel died! Game over!') done = True - - if native_close <= 0: + + #yet another way to lose + if natives_range >= miles_left: print('The Natives got you! Game over!') done = True \ No newline at end of file diff --git a/Worksheets/worksheet_04.txt b/Worksheets/worksheet_04.txt index d4299f7..83fa556 100644 --- a/Worksheets/worksheet_04.txt +++ b/Worksheets/worksheet_04.txt @@ -63,7 +63,8 @@ print(randint(1,10)) 1 and 10 (inclusive). Do not make the mistake of generating a random number from 0 to 10 instead of 1 to 10. -????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +for i in range(0,11): + print(float(i)) 8. Write a Python program that will: (3 pts) From 56762bb347e06c86f122af2870003652ee811e10 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 7 Nov 2017 10:13:09 -0600 Subject: [PATCH 14/27] started chapter 5 worksheet 5 --- Worksheets/worksheet_05.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Worksheets/worksheet_05.txt b/Worksheets/worksheet_05.txt index 275a18a..0ca46f2 100644 --- a/Worksheets/worksheet_05.txt +++ b/Worksheets/worksheet_05.txt @@ -8,20 +8,34 @@ 1. Explain how the computer coordinate system differs from the standard Cartesian coordinate system. There are two main differences. List both. + The main differences are that that the y coordinates are reversed and focuses on the lower right quadrant rather than the upper right quadrant. + 2. Before a Python Pygame program can use any functions like pygame.display.set_mode(), what two lines of code must occur first? + pygame needs to be imported and the screen size needs to be established before the display is set. + 3. Explain how WHITE = (255, 255, 255) represents a color. + It displays green, red, and blue at full intensity, which makes white. + 4. When do we use variable names for colors in all upper-case, and when do we use variable names for colors in all lower-case? (This applies to all variables, not just colors.) + + Upper case is used for variables that will never change, such as a color. 5. What does the pygame.display.set_mode() function do? + + This opens up a new window. 6. What does this for event in pygame.event.get() loop do? + + This makes it so it will take user input. 7. What is pygame.time.Clock used for? + + This is how fast the screen updates. 8. For this line of code: (3 pts) @@ -32,10 +46,18 @@ * What does [100, 100] do? * What does 5 do? +It tells where to draw the line +0,0 is the starting point +100,100 is the ending point +5 is the width of the line in pixels 9. What is the best way to repeat something over and over in a drawing? + + use a loop 10. When drawing a rectangle, what happens if the specified line width is zero? + + nothing will happen, as it is specified to have no pixels wide. 11. Describe the ellipse drawn in the code below. * What is the x, y of the origin coordinate? @@ -45,6 +67,10 @@ pygame.draw.ellipse(screen, BLACK, [20, 20, 250, 100], 2) + 20, 20 + The origin is the center of the circle, where there is nothing drawn. + the length is 250, width is 100. + 12. When drawing an arc, what additional information is needed over drawing an ellipse? From ec479a19a339b36d4fe9f6ccb66fb52b07cdc80b Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 8 Nov 2017 10:12:35 -0600 Subject: [PATCH 15/27] Finished worksheet 5 and started lab 5 --- Lab 05 - Create a Picture/main_program.py | 29 ++++++++++++++++++++++- Worksheets/worksheet_05.txt | 16 ++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Lab 05 - Create a Picture/main_program.py b/Lab 05 - Create a Picture/main_program.py index 792d600..a87a24e 100644 --- a/Lab 05 - Create a Picture/main_program.py +++ b/Lab 05 - Create a Picture/main_program.py @@ -1 +1,28 @@ -# +#!/usr/bin/env python3 +#Lab 5 Draw a Picture +#Bethany DuMontelle +#8 November 2017 + +#Starts up pygame +import pygame +pygame.init() + +#Establishes colors +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +LIGHT_GREEN = (74, 224, 129) + +size = (800, 800) +screen = pygame.display.set_mode(size) + +done = False +while not done: + + pygame.draw.ellipse(screen, LIGHT_GREEN, [50, 50, 40, 40], 5) + + pygame.display.update() + + for event in pygame.event.get(): + if event.type == pygame.QUIT: + done = True +pygame.quit() \ No newline at end of file diff --git a/Worksheets/worksheet_05.txt b/Worksheets/worksheet_05.txt index 0ca46f2..58012e1 100644 --- a/Worksheets/worksheet_05.txt +++ b/Worksheets/worksheet_05.txt @@ -57,7 +57,7 @@ It tells where to draw the line 10. When drawing a rectangle, what happens if the specified line width is zero? - nothing will happen, as it is specified to have no pixels wide. +The polygon will be filled. 11. Describe the ellipse drawn in the code below. * What is the x, y of the origin coordinate? @@ -73,23 +73,37 @@ It tells where to draw the line 12. When drawing an arc, what additional information is needed over drawing an ellipse? + + It needs to know what the radians is for the angle of the arc. 13. Describe, in general, what are the three steps needed when printing text to the screen using graphics? + It needs to know what text to write, information about the text(color, size, font, etc), and where is place the text on the screen. + 14. When drawing text, the first line of the three lines needed to draw text should actually be outside the main program loop. It should only run once at the start of the program. Why is this? You may need to ask. + + This is because one the text information is established, there's no need to keep telling it what the text should be when it already had the information before the loop started. 15. What are the coordinates of the polygon that the code below draws? pygame.draw.polygon(screen, BLACK, [[50,100],[0,200],[200,200],[100,50]], 5) + The coordinates are where each point of the polygon is located on the screen, and 5 is the width of each line drawn. + 16. What does pygame.display.flip() do? + + This updates the screen with what was drawn. 17. What does pygame.quit() do? + + This closes the window and stops the program. 18. Look up on-line how the pygame.draw.circle works. Get it working and paste a working sample here. I only need the one line of code that draws the circle, but make sure it is working by trying it out in a full working program. + pygame.draw.circle(screen, WHITE, (200, 200), 20, 5) + From ec102a63ca8e516617c6cb9166b7be6345750de4 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Thu, 9 Nov 2017 09:14:16 -0600 Subject: [PATCH 16/27] completed chapter 5 --- Lab 05 - Create a Picture/main_program.py | 50 ++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/Lab 05 - Create a Picture/main_program.py b/Lab 05 - Create a Picture/main_program.py index a87a24e..fa36982 100644 --- a/Lab 05 - Create a Picture/main_program.py +++ b/Lab 05 - Create a Picture/main_program.py @@ -11,6 +11,13 @@ BLACK = (0, 0, 0) WHITE = (255, 255, 255) LIGHT_GREEN = (74, 224, 129) +LIGHT_BLUE = (52, 198, 247) +DEEP_PURPLE = (79,18,201) +SKY = (235, 193, 96) +SUN_YELLOW = (246, 255, 0) +SUN_RING = (219, 222, 95) +PANK = (235, 103, 226) +RED = (224, 13, 52) size = (800, 800) screen = pygame.display.set_mode(size) @@ -18,8 +25,49 @@ done = False while not done: - pygame.draw.ellipse(screen, LIGHT_GREEN, [50, 50, 40, 40], 5) + #changes background color + screen.fill(SKY) + #Makes the ocean + pygame.draw.rect(screen, LIGHT_BLUE, [0, 350, 800, 800], 0) + + #Creates ring around the sun + pygame.draw.circle(screen, SUN_RING, [10, 10], 140, 0) + + #Creates the sun + pygame.draw.circle(screen, SUN_YELLOW, [10, 10], 100, 0) + + #octopus legs + pygame.draw.line(screen, DEEP_PURPLE, [300, 350], [125, 500], 40) + pygame.draw.line(screen, DEEP_PURPLE, [300, 380], [220, 600], 40) + pygame.draw.line(screen, DEEP_PURPLE, [340, 380], [300, 620], 40) + pygame.draw.line(screen, DEEP_PURPLE, [380, 380], [360, 590], 40) + pygame.draw.line(screen, DEEP_PURPLE, [420, 380], [420, 625], 40) + pygame.draw.line(screen, DEEP_PURPLE, [460, 380], [480, 595], 40) + pygame.draw.line(screen, DEEP_PURPLE, [500, 380], [550, 585], 40) + pygame.draw.line(screen, DEEP_PURPLE, [510, 350], [630, 570], 40) + + #octopus body + pygame.draw.ellipse(screen, DEEP_PURPLE, [275, 200, 250, 275], 0) + + #octopus eyes + pygame.draw.ellipse(screen, WHITE, [335, 300, 35, 35], 0) + pygame.draw.ellipse(screen, BLACK, [340, 310 , 25, 25], 0) + pygame.draw.ellipse(screen, WHITE, [435, 300, 35, 35], 0) + pygame.draw.ellipse(screen, BLACK, [440, 310 , 25, 25], 0) + + #octopus mouth + pygame.draw.polygon(screen, PANK, [[400, 420], [440, 360], [360, 360]], 0) + pygame.draw.polygon(screen, RED, [[400, 412], [420, 380], [380, 380]], 0) + + #Seaweed + x_offset = 20 + while x_offset < 780: + pygame.draw.line(screen, LIGHT_GREEN, [20 + x_offset, 600],\ + [20 + x_offset, 800], 15) + x_offset = x_offset + 40 + + #updates the screen to show the picture pygame.display.update() for event in pygame.event.get(): From 6f3f49780892ac13ec5032dbb62c1447e50e1e5b Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 14 Nov 2017 10:12:18 -0600 Subject: [PATCH 17/27] started worksheet 6 --- Worksheets/worksheet_06.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Worksheets/worksheet_06.txt b/Worksheets/worksheet_06.txt index 35e5f13..8708142 100644 --- a/Worksheets/worksheet_06.txt +++ b/Worksheets/worksheet_06.txt @@ -18,12 +18,18 @@ print(x) x = x + 2 + guess: 0, 2, 4, 6, 8(on separate lines) + actual: 0, 2, 4, 6 ,8(on separate lines) + 2. What does this program print out? x = 1 while x < 64: print(x) x = x * 2 + + guess: 1, 2, 4, 8, 16, 32(separate lines) + actual: 1, 2, 4, 8, 16, 32(separate lines) 3. Why is the and x >= 0 not needed? @@ -32,6 +38,8 @@ print(x) x = x + 2 + x is already 0 and will never decrease, never making the statement true. + 4. What does this program print out? (0 pts) Explain. (1 pt) x = 5 @@ -40,6 +48,8 @@ if x == "1": print("Blast off!") x = x - 1 + + The program prints out 5, 4, 3, 2, 1, and 0 on separate lines because 1 in in quotes, making 1 a string. 5. Fix the following code so it doesn't repeat forever, and keeps asking the user until he or she enters a number greater than zero: (2 pts) @@ -49,6 +59,11 @@ while x <= 0: print("Too small. Enter a number greater than zero: ") + x = float(input("Enter a number greater than zero: ")) + + while x <= 0: + x = input("Too small. Enter a number greater than zero: ") + 6. Fix the following code: x = 10 @@ -59,6 +74,8 @@ print("Blast-off") + + 7. What is wrong with this code? It runs but it has unnecessary code. Find all the unneeded code. Also, answer why it is not needed. (1 pt) From 28aafc896af1e6ab7a43064c105307c71c0b371e Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 15 Nov 2017 08:02:04 -0600 Subject: [PATCH 18/27] completed chapter 6 worksheet --- Worksheets/worksheet_06.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Worksheets/worksheet_06.txt b/Worksheets/worksheet_06.txt index 8708142..50f5a19 100644 --- a/Worksheets/worksheet_06.txt +++ b/Worksheets/worksheet_06.txt @@ -74,7 +74,13 @@ print("Blast-off") - + x = 10 + + while x > 0: + print(x) + x - 1 + + print("Blast-off") 7. What is wrong with this code? It runs but it has unnecessary code. Find all the unneeded code. Also, answer why it is not needed. (1 pt) @@ -84,6 +90,11 @@ print(i) i += 1 + for i in range(10): + print(i) + + in the range on i, it's already established as 0 in default and the range increases each time, so adding one to i each time is pointless. + 8. Explain why the values printed for x are so different. (2 pts) # Sample 1 @@ -102,4 +113,6 @@ x += 1 print(x) + This is because of the indentation of the lines. The first sample adds one to x 10 times in i then another 10 in j, printing 20. Sample 2 adds has i add one, then goes to j to add 1 to x 10 more times, then repeats this 10 times. + From 31c3a250cb56b6798abd237c39c877285c13a538 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 15 Nov 2017 09:20:31 -0600 Subject: [PATCH 19/27] completes labs 1, 2, and 4 in chapter 6 --- Lab 06 - Loopy Lab/part_1.py | 17 ++++++++++++++++ Lab 06 - Loopy Lab/part_2.py | 22 ++++++++++++++++++++- Lab 06 - Loopy Lab/part_3.py | 7 ++++++- Lab 06 - Loopy Lab/part_4.py | 38 +++++++++++++++++++++++++++++++++++- 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/Lab 06 - Loopy Lab/part_1.py b/Lab 06 - Loopy Lab/part_1.py index 8b13789..c83aef5 100644 --- a/Lab 06 - Loopy Lab/part_1.py +++ b/Lab 06 - Loopy Lab/part_1.py @@ -1 +1,18 @@ +#!/usr/bin/env python3 +#Lab Part 1 +#Bethany DuMontelle +#15 November 2017 +#Establish starting number +start = 10 + +#loops it 9 times +for numbers in range(9): + +#adds 1 plus the range when it does down + for down in range(numbers + 1): + print( start , end = ' ') + start += 1 + +#new print statement at the end + print() \ No newline at end of file diff --git a/Lab 06 - Loopy Lab/part_2.py b/Lab 06 - Loopy Lab/part_2.py index 792d600..c44cdbc 100644 --- a/Lab 06 - Loopy Lab/part_2.py +++ b/Lab 06 - Loopy Lab/part_2.py @@ -1 +1,21 @@ -# +#!/usr/bin/env python3 +#Lab Part 2 +#Bethany DuMontelle +#15 November 2017 + +#ask user for number of zeros +number = int(input('How many o\'s? ')) + +#spaces used later +spaces = (number * 2) - 2 + +#print zeros times number times 2 +print('o' * ((number) * 2)) + +#loop the number of times the user asked - 2 with o's, add the spaces from +#earlier, then add another o +for o1 in range(1, number - 1): + print('o' + (' ' * spaces) + 'o') + +#repeat zeros on bottom +print('o' * ((number) * 2)) \ No newline at end of file diff --git a/Lab 06 - Loopy Lab/part_3.py b/Lab 06 - Loopy Lab/part_3.py index 792d600..ce022c1 100644 --- a/Lab 06 - Loopy Lab/part_3.py +++ b/Lab 06 - Loopy Lab/part_3.py @@ -1 +1,6 @@ -# +#!/usr/bin/env python3 +#Lab Part 3 +#Bethany DuMontelle +#15 November 2017 + +#We don't have to do this but I almost started on it so that's why this is here \ No newline at end of file diff --git a/Lab 06 - Loopy Lab/part_4.py b/Lab 06 - Loopy Lab/part_4.py index 792d600..347ccb2 100644 --- a/Lab 06 - Loopy Lab/part_4.py +++ b/Lab 06 - Loopy Lab/part_4.py @@ -1 +1,37 @@ -# +#!/usr/bin/env python3 +#Lab Part 4 +#Bethany DuMontelle +#17 November 2017 + +#start pygame +import pygame +pygame.init() + +#Set up and open up the screen +size = (800, 800) +screen = pygame.display.set_mode(size) + +#set the colors for the pattern +LIGHT_BLUE = (52, 198, 247) + +#starts the exit option +done = False +while not done: + +#loop it across the screen + y_offset = -4 + for x in range(1, 100): + y_offset = y_offset + 10 + x_offset = 6 + for y in range(1, 100): + pygame.draw.circle(screen, LIGHT_BLUE, [x_offset, y_offset], 3, 0) + x_offset = x_offset + 10 + +#screen updates + pygame.display.update() + +#exit + for event in pygame.event.get(): + if event.type == pygame.QUIT: + done = True +pygame.quit() \ No newline at end of file From 1d660ff29b15aa1371bf51bb9c2630a7197fc982 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Mon, 20 Nov 2017 08:03:25 -0600 Subject: [PATCH 20/27] Completed worksheet 7 1 - 8 --- Worksheets/worksheet_07.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Worksheets/worksheet_07.txt b/Worksheets/worksheet_07.txt index a87ff3f..d71e80f 100644 --- a/Worksheets/worksheet_07.txt +++ b/Worksheets/worksheet_07.txt @@ -8,6 +8,11 @@ 1. List the four types of data we've covered, and give an example of each: + + string - list = ["This", "is", "a", "string"] + Integer - list = [3, 1, 4, 1, 5, 9] + Floating point - list = [5.234, 6.234, 9.534] + Boolean - list = [True, False] 2. What does this code print out? For this and the following problems, make sure you understand WHY it prints what it does. You don't have to explain it, @@ -19,11 +24,15 @@ print(my_list[4]) print(my_list[5]) + It prints out 2, 101, then an error. + 3. What does this code print out? my_list=[5, 2, 6, 8, 101] for my_item in my_list: print(my_item) + + It prints out 5, 2, 6, 8, and 101 on separate lines. 4. What does this code print out? @@ -34,6 +43,8 @@ my_list2[2] = 10 print(my_list2) + It prints out an error. + 5. What does this code print out? my_list = [3 * 5] @@ -41,6 +52,8 @@ my_list = [3] * 5 print(my_list) + It prints out [15] then [3, 3, 3, 3, 3] + 6. What does this code print out? my_list = [5] @@ -48,6 +61,8 @@ my_list.append(i) print(my_list) + The code prints out 5, 0, 1, 2, 3, and 4 in square brackets. + 7. What does this code print out? print(len("Hi")) @@ -56,12 +71,16 @@ print(len("2")) print(len(2)) + This code prints out 2, 9, 8, and 1 on separate lines, then an error. + 8. What does this code print out? print("Simpson" + "College") print("Simpson" + "College"[1]) print( ("Simpson" + "College")[1] ) + It prints out SimpsonCollege, Simpsono, and i on separate lines. + 9. What does this code print out? word = "Simpson" From ac72373850dc6713a534c53451dfd2e62694e2dc Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Mon, 20 Nov 2017 08:31:25 -0600 Subject: [PATCH 21/27] Finshed 9 - 15 on worksheet 7 --- Worksheets/worksheet_07.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Worksheets/worksheet_07.txt b/Worksheets/worksheet_07.txt index d71e80f..1e34d42 100644 --- a/Worksheets/worksheet_07.txt +++ b/Worksheets/worksheet_07.txt @@ -86,6 +86,8 @@ word = "Simpson" for letter in word: print(letter) + + This prints out S, i, m, p, s, o , and n on separate lines. 10. What does this code print out? @@ -94,17 +96,23 @@ word += "College" print(word) + This code prints out SimpsonCollegeCollegeCollege. + 11. What does this code print out? word = "Hi" * 3 print(word) + HiHiHi is printed out. + 12. What does this code print out? my_text = "The quick brown fox jumped over the lazy dogs." print("The 3rd spot is: " + my_text[3]) print("The -1 spot is: " + my_text[-1]) + It prints out "The 3rd spot is: " with a space at the end and "The -1 spot is: " with a . at the end. + 13. What does this code print out? s = "0123456789" @@ -112,9 +120,17 @@ print(s[:3]) print(s[3:]) + The code prints out 1, 012, and 3456789. + 14. Write a loop that will take in a list of five numbers from the user, adding each to an array. Then print the array. Try doing this without looking at the book. + +a_list = [] +for num_in_list in range(5): + user_number = input('Enter a number to add to the list: ') + a_list.append(int(user_number)) + print(a_list) 15. Write a program that take an array like the following, and print the average. Use the len function, don't just use 15, because that won't work if @@ -124,4 +140,10 @@ my_list = [3,12,3,5,3,4,6,8,5,3,5,6,3,2,4] +sum = 0 +my_list = [3,12,3,5,3,4,6,8,5,3,5,6,3,2,4] +for i in range(len(my_list)): + sum = sum + my_list[i] +average = sum// len(my_list) +print(average) From 1331db57937eaaef321ea7e675525151dba69efa Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Mon, 20 Nov 2017 10:02:03 -0600 Subject: [PATCH 22/27] Started lab 7; started describing each room --- Lab 07 - Adventure/main_program.py | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index 792d600..7d3da26 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -1 +1,35 @@ -# +#!/usr/bin/env python3 +#Chapter 7 Lab +#Bethany DuMontelle +#November 20 2017 + +room_list = [bedroom, dinning_room, basement, balcony, party_room, + kitchen, attic] + +bedroom = ['As soon as you walk into the bedroom, it becomes apparent\ +that you are not alone in this room. The adjacent rooms illuminate\ +the one you\'re currently in; no lights exist in here. You can only see a bed\ +covered in dark gray rags and an old wooden dresser that would\ +fall apart if you happen to move past it.', 4, 1, None, None] + +dinning_room = ['The chadelier hangs from the ceiling above the long dinner \ +table. The table itself is neatly organzed: the red table cloth is at equal \ +length on all sides, plates correspond to each chair, the spoons, knives, and\ +forks are all to the side of each plate, chairs neatly tucked in, and all the \ +decor matches the rest of the table It\'s as if you walked in just before the\ +food was placed on the table.', 5, 2, None, 0] + +basement = ['As you walk into the basement, you can hear what is most likely \ +water dripping, echoing with each drop. Darkness engulfs the room when \ +you walk further into it. It smells musty. If you walk any further into the\ +basement, you feel like you will never find your way back \ +out.', None, None, None, 1] + +balcony = ['', None, 4, None, None] + +party_room = [' ', 6, 5, 0, 3] + +kitchen = [' ', None, None, 1, 4] + +attic = [' ', None, None, 4, None] + From 7e826e9973d3ae7a084b76af4f5cc75ff2bc6a7f Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Mon, 20 Nov 2017 10:13:41 -0600 Subject: [PATCH 23/27] added more descritions to lab 7 --- Lab 07 - Adventure/main_program.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index 7d3da26..8b3f1b9 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -10,22 +10,26 @@ that you are not alone in this room. The adjacent rooms illuminate\ the one you\'re currently in; no lights exist in here. You can only see a bed\ covered in dark gray rags and an old wooden dresser that would\ -fall apart if you happen to move past it.', 4, 1, None, None] +fall apart if you happen to move past it. You can either go to the party room\ +north or the dinning room east.', 4, 1, None, None] dinning_room = ['The chadelier hangs from the ceiling above the long dinner \ table. The table itself is neatly organzed: the red table cloth is at equal \ length on all sides, plates correspond to each chair, the spoons, knives, and\ forks are all to the side of each plate, chairs neatly tucked in, and all the \ decor matches the rest of the table It\'s as if you walked in just before the\ -food was placed on the table.', 5, 2, None, 0] +food was placed on the table. You can go the kitchen north, the bedroom west,\ +or the basement west.', 5, 2, None, 0] basement = ['As you walk into the basement, you can hear what is most likely \ water dripping, echoing with each drop. Darkness engulfs the room when \ you walk further into it. It smells musty. If you walk any further into the\ -basement, you feel like you will never find your way back \ -out.', None, None, None, 1] +basement, you feel like you will never find your way back out You can only\ +go west back to the dining room.', None, None, None, 1] -balcony = ['', None, 4, None, None] +balcony = ['The outdoors are far brighter than inside the house, despite\ +it being night. The air is nippy, and all you can see are trees past the\ +balcony. You can only go east back to the party room.', None, 4, None, None] party_room = [' ', 6, 5, 0, 3] From 5eca26963a40836ac49cab7f01713f66e097b157 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 28 Nov 2017 08:10:07 -0600 Subject: [PATCH 24/27] finished descriptions of rooms and appends it to the room_list --- Lab 07 - Adventure/main_program.py | 70 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index 8b3f1b9..90748d5 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -3,37 +3,39 @@ #Bethany DuMontelle #November 20 2017 -room_list = [bedroom, dinning_room, basement, balcony, party_room, - kitchen, attic] - -bedroom = ['As soon as you walk into the bedroom, it becomes apparent\ -that you are not alone in this room. The adjacent rooms illuminate\ -the one you\'re currently in; no lights exist in here. You can only see a bed\ -covered in dark gray rags and an old wooden dresser that would\ -fall apart if you happen to move past it. You can either go to the party room\ -north or the dinning room east.', 4, 1, None, None] - -dinning_room = ['The chadelier hangs from the ceiling above the long dinner \ -table. The table itself is neatly organzed: the red table cloth is at equal \ -length on all sides, plates correspond to each chair, the spoons, knives, and\ -forks are all to the side of each plate, chairs neatly tucked in, and all the \ -decor matches the rest of the table It\'s as if you walked in just before the\ -food was placed on the table. You can go the kitchen north, the bedroom west,\ -or the basement west.', 5, 2, None, 0] - -basement = ['As you walk into the basement, you can hear what is most likely \ -water dripping, echoing with each drop. Darkness engulfs the room when \ -you walk further into it. It smells musty. If you walk any further into the\ -basement, you feel like you will never find your way back out You can only\ -go west back to the dining room.', None, None, None, 1] - -balcony = ['The outdoors are far brighter than inside the house, despite\ -it being night. The air is nippy, and all you can see are trees past the\ -balcony. You can only go east back to the party room.', None, 4, None, None] - -party_room = [' ', 6, 5, 0, 3] - -kitchen = [' ', None, None, 1, 4] - -attic = [' ', None, None, 4, None] - +#creates the room list +room_list = [] + +#establishes all the room descriptions and the direction numbers +bedroom = 'There\'s nothing of interest in here. You can either go north into\ +the party room or in the dining room east.', 4, 1, None, None + +dinning_room = 'There\'s a table in here neatly set up. You can go to the\ + bedroom west, the kitchen north, and the basement east.', 5, 2, None, 0 + +basement = 'It is very spooky down here. You can\'t see anything.\ +You can only go back west to the dining room.', None, None, None, 1 + +balcony = 'It\'s little chilly out today. You can only go back into the\ +party room.', None, 4, None, None + +party_room = 'There is a disco ball on the ceiling and a dance floor. \ +Other than that, nothing else is here. You can go west to the balcony, \ +north to the attic, east to the kitchen, and south to the bedroom.', 6, 5, 0, 3 + +kitchen = 'The wall is covered in knives. Seems safe enough. You can go \ +west to the party room or south to the dining room.', None, None, 1, 4 + +attic = 'Wow! Look at all the dust. You could make a small garden with \ +all the dust in here. You may want to leave before the dust is a mild \ +inconvenience. You can only go south back to the\ +party room.', None, None, 4, None + +#appends it all to the room_list +room_list.append(bedroom) +room_list.append(dinning_room) +room_list.append(basement) +room_list.append(balcony) +room_list.append(party_room) +room_list.append(kitchen) +room_list.append(attic) \ No newline at end of file From 6b27bd8f1679c45cab76161eb4fa4b7348d1bf4a Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 28 Nov 2017 08:56:33 -0600 Subject: [PATCH 25/27] got loop for the rooms to work, now I just need to make it look nicer --- Lab 07 - Adventure/main_program.py | 74 ++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 15 deletions(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index 90748d5..b4af16e 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -7,29 +7,30 @@ room_list = [] #establishes all the room descriptions and the direction numbers -bedroom = 'There\'s nothing of interest in here. You can either go north into\ -the party room or in the dining room east.', 4, 1, None, None +#note: the number direction order is: north, east, south, west +bedroom = ['There\'s nothing of interest in here. You can either go north into \ +the party room or in the dining room east.', 4, 1, None, None] -dinning_room = 'There\'s a table in here neatly set up. You can go to the\ - bedroom west, the kitchen north, and the basement east.', 5, 2, None, 0 +dinning_room = ['There\'s a table in here neatly set up. You can go to the\ + bedroom west, the kitchen north, and the basement east.', 5, 2, None, 0] -basement = 'It is very spooky down here. You can\'t see anything.\ -You can only go back west to the dining room.', None, None, None, 1 +basement = ['It is very spooky down here. You can\'t see anything.\ +You can only go back west to the dining room.', None, None, None, 1] -balcony = 'It\'s little chilly out today. You can only go back into the\ -party room.', None, 4, None, None +balcony = ['It\'s little chilly out today. You can only go back into the\ +party room.', None, 4, None, None] -party_room = 'There is a disco ball on the ceiling and a dance floor. \ +party_room = ['There is a disco ball on the ceiling and a dance floor. \ Other than that, nothing else is here. You can go west to the balcony, \ -north to the attic, east to the kitchen, and south to the bedroom.', 6, 5, 0, 3 +north to the attic, east to the kitchen, and south to the bedroom.', 6, 5, 0, 3] -kitchen = 'The wall is covered in knives. Seems safe enough. You can go \ -west to the party room or south to the dining room.', None, None, 1, 4 +kitchen = ['The wall is covered in knives. Seems safe enough. You can go \ +west to the party room or south to the dining room.', None, None, 1, 4] -attic = 'Wow! Look at all the dust. You could make a small garden with \ +attic = ['Wow! Look at all the dust. You could make a small garden with \ all the dust in here. You may want to leave before the dust is a mild \ inconvenience. You can only go south back to the\ -party room.', None, None, 4, None +party room.', None, None, 4, None] #appends it all to the room_list room_list.append(bedroom) @@ -38,4 +39,47 @@ room_list.append(balcony) room_list.append(party_room) room_list.append(kitchen) -room_list.append(attic) \ No newline at end of file +room_list.append(attic) + +#whatever room you are in +current_room = 0 + +#sets up the loop +done = False + + +while done == False: + print() + print(room_list[current_room][0]) + direction = str(input('Where would you like to go now? ')) + + if direction.lower() == 'n' or direction.lower() == 'north': + if room_list[current_room][1] != None: + current_room = room_list[current_room][1] + else: + print('You can\'t go that way!') + + elif direction.lower() == 'e' or direction.lower() == 'east': + if room_list[current_room][2] != None: + current_room = room_list[current_room][2] + else: + print('You can\'t go that way!') + + elif direction.lower() == 's' or direction.lower() == 'south': + if room_list[current_room][3] != None: + current_room = room_list[current_room][3] + else: + print('You can\'t go that way!') + + elif direction.lower() == 'w 'or direction.lower() == 'west': + if room_list[current_room][4] != None: + current_room = room_list[current_room][4] + else: + print('You can\'t go that way!') + + elif direction.lower() == 'quit': + print('Okay.') + done = True + + else: + print('I don\'t understand.') \ No newline at end of file From d0669da607bd82e0e1715febc1b5aacf96f1cace Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Tue, 28 Nov 2017 09:06:31 -0600 Subject: [PATCH 26/27] Finished fixing up lab 7 --- Lab 07 - Adventure/main_program.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index b4af16e..caa6910 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -8,28 +8,29 @@ #establishes all the room descriptions and the direction numbers #note: the number direction order is: north, east, south, west -bedroom = ['There\'s nothing of interest in here. You can either go north into \ -the party room or in the dining room east.', 4, 1, None, None] +bedroom = ['There\'s nothing of interest in here. You can either go \nnorth \ +into the party room or in the dining room east.', 4, 1, None, None] dinning_room = ['There\'s a table in here neatly set up. You can go to the\ - bedroom west, the kitchen north, and the basement east.', 5, 2, None, 0] + bedroom\nwest, the kitchen north, and the basement east.', 5, 2, None, 0] -basement = ['It is very spooky down here. You can\'t see anything.\ -You can only go back west to the dining room.', None, None, None, 1] +basement = ['It is very spooky down here. You can\'t see anything. \ +You can\nonly go back west to the dining room.', None, None, None, 1] -balcony = ['It\'s little chilly out today. You can only go back into the\ -party room.', None, 4, None, None] +balcony = ['It\'s little chilly out today. You can only go back\ninto the \ +party room east.', None, 4, None, None] party_room = ['There is a disco ball on the ceiling and a dance floor. \ -Other than that, nothing else is here. You can go west to the balcony, \ -north to the attic, east to the kitchen, and south to the bedroom.', 6, 5, 0, 3] +Other than\nthat, nothing else is here. You can go west to the balcony, \ +north to the\nattic, east to the kitchen, and south to \ +the bedroom.', 6, 5, 0, 3] -kitchen = ['The wall is covered in knives. Seems safe enough. You can go \ +kitchen = ['The wall is covered in knives. Seems safe enough.\nYou can go \ west to the party room or south to the dining room.', None, None, 1, 4] attic = ['Wow! Look at all the dust. You could make a small garden with \ -all the dust in here. You may want to leave before the dust is a mild \ -inconvenience. You can only go south back to the\ +all the\ndust in here. You may want to leave before the dust is a mild \ +inconvenience.\nYou can only go south, back to the \ party room.', None, None, 4, None] #appends it all to the room_list @@ -71,7 +72,7 @@ else: print('You can\'t go that way!') - elif direction.lower() == 'w 'or direction.lower() == 'west': + elif direction.lower() == 'w' or direction.lower() == 'west': if room_list[current_room][4] != None: current_room = room_list[current_room][4] else: From 1d25d1371c59a2cea6a96b83877cc076165ab4b4 Mon Sep 17 00:00:00 2001 From: BethanyDuMontelle Date: Wed, 29 Nov 2017 08:25:34 -0600 Subject: [PATCH 27/27] added more comments and improved each room description --- Lab 07 - Adventure/main_program.py | 49 ++++++++++++++++++------------ 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/Lab 07 - Adventure/main_program.py b/Lab 07 - Adventure/main_program.py index caa6910..563969d 100644 --- a/Lab 07 - Adventure/main_program.py +++ b/Lab 07 - Adventure/main_program.py @@ -3,35 +3,42 @@ #Bethany DuMontelle #November 20 2017 +"""Just a program that lets you go into a variety of rooms""" + #creates the room list room_list = [] #establishes all the room descriptions and the direction numbers #note: the number direction order is: north, east, south, west -bedroom = ['There\'s nothing of interest in here. You can either go \nnorth \ -into the party room or in the dining room east.', 4, 1, None, None] +#the layout is in my notebook on page 37 +bedroom = ['You\'re in the bedroom. There\'s nothing of interest in here. \ +You can either go \nnorth into the party room or in the \ +dining room east.', 4, 1, None, None] -dinning_room = ['There\'s a table in here neatly set up. You can go to the\ - bedroom\nwest, the kitchen north, and the basement east.', 5, 2, None, 0] +dinning_room = ['This is the dinning room. There\'s a table in here neatly \ +set up. You can go to the bedroom\nwest, the kitchen north, \ +and the basement east.', 5, 2, None, 0] -basement = ['It is very spooky down here. You can\'t see anything. \ -You can\nonly go back west to the dining room.', None, None, None, 1] +basement = ['You are in the basement. It is very spooky down here.\ +You can\'t see anything. You can\nonly go back west \ +to the dining room.', None, None, None, 1] -balcony = ['It\'s little chilly out today. You can only go back\ninto the \ -party room east.', None, 4, None, None] +balcony = ['You\'re on the balcony. It\'s little chilly out today. You \ +can only go back\ninto the party room east.', None, 4, None, None] -party_room = ['There is a disco ball on the ceiling and a dance floor. \ -Other than\nthat, nothing else is here. You can go west to the balcony, \ -north to the\nattic, east to the kitchen, and south to \ -the bedroom.', 6, 5, 0, 3] +party_room = ['It\'s the party room! There is a disco ball on the ceiling and \ +a dance floor. Other than\nthat, nothing else is here. You can go west to the \ +balcony, north to the\nattic, east to the kitchen, and south to the \ +bedroom.', 6, 5, 0, 3] -kitchen = ['The wall is covered in knives. Seems safe enough.\nYou can go \ -west to the party room or south to the dining room.', None, None, 1, 4] +kitchen = ['This is the kitchen. The wall is covered in knives. Seems safe e\ +nough.\nYou can go west to the party room or south to the dining r\ +oom.', None, None, 1, 4] -attic = ['Wow! Look at all the dust. You could make a small garden with \ -all the\ndust in here. You may want to leave before the dust is a mild \ -inconvenience.\nYou can only go south, back to the \ -party room.', None, None, 4, None] +attic = ['You\'re in the attic. Wow! Look at all the dust. You could make a \ +small garden with all the\ndust in here. You may want to leave before the dus\ +t is a mild inconvenience.\nYou can only go south, back to the p\ +arty room.', None, None, 4, None] #appends it all to the room_list room_list.append(bedroom) @@ -48,12 +55,14 @@ #sets up the loop done = False - +#starts the game loop while done == False: print() print(room_list[current_room][0]) direction = str(input('Where would you like to go now? ')) + #all the directions possible to go, the else statement stops impossible + #movement for each direction if direction.lower() == 'n' or direction.lower() == 'north': if room_list[current_room][1] != None: current_room = room_list[current_room][1] @@ -78,9 +87,11 @@ else: print('You can\'t go that way!') + #ends the game elif direction.lower() == 'quit': print('Okay.') done = True + #If the statement doesn't equal any of the above words this will print else: print('I don\'t understand.') \ No newline at end of file