Friday, February 28, 2020

Lesson 3.3 - Return vs. Print

  • Every function returns a value.
    • As soon as your function returns a value, no code below this return is executed
    • In Python, if you do not specify a return value it defaults to None type. 
    • A function's return value is commonly nested inside of other functions. For example:
      • print( foo() )
      • bar( foo( ) + 3 )
      • foo( input('feed me a string' ) )

     Due Friday, March 1 2019 :
    1.  Reading 3.3 - Return Values of Functions
    2. Study for Upcoming Chapter 2Quiz 
    3. 3.3a valid triangle, 3.3b angle class, 3.3c side class

    Wednesday, February 26, 2020

    Lesson 3.2 - More Designed Functions with Parameters

    • Functions
        • Define functions with parameters (variables in the argument)
          • Learn to call these functions changing elements
          • Know the return value of your functions

       Due Friday February 28, 2020 :
      1.  3.2 - Reading: Functions, Parameters
      2. 3.2a sumToNumber, 3.2b SumBetween, 3.2C sumOddsBetween, 3.2d fizzBuzz

      Tuesday, February 25, 2020

      3.1 Built-in Funcions

      Lesson 3.1 - Built-in Functions and Custom Functions with no Argument

      • Functions
        • Import the random library with one line of code at the top of your script: import random
          • Read documentation on the random library here: Python random library
          • Be able to generate a random integer by calling: random.randint(x,y)
          • Be able to generate a random probability (0 <= p <= 1) by calling: random.random( )

        • Import the math library with one line of code at the top of your script:  import math

        • Define functions with no argument variable
          • Learn to call these functions changing elements
          • Know the return value of your functions

      Note on multi-line lists:
      The closing brace/bracket/parenthesis on multi-line constructs may line up under the first non-whitespace character of the last line of list, as in:
      my_list = [1, 2, 3,
                 4, 5, 6,]

         Due Wednesday February 26, 2020 :


        1.  3.1 - Reading: Math Functions, Compositions of Fns.
        2. www.google.com
        3. Do these labs on repl.it: 

        • 3.1a isPositive()
        • 3.1b isEven()
        • 3..1c minimum()


        Thursday, February 13, 2020

        Text Based Adventure Game Update

        Project02 Monster Adventure Game - Milestones



          Milestone 1

        1. Pay attention: Name your project lastName_FirstName_proj2Monster-v01.py  
        2. Create a game board on PAPER.
        3. Name your file lastName_FirstName_proj2Monster-v01.py
        4. Create the standard 9 room map: mymap and print room numbers showing 3 rooms per floor
        5. Two choices: 
          1. Create the standard lists: stairs_list -> [ . , . ], swords_list -> [ . , . ], magicStones_list ->[ . , . ], monsters_list ->[ . , . ], inventory_list -> [], and boss_list[ . , . ]. The content of each element in the list should either be a True or False to indicate whether the item is in the room. inventory_list should be an empty list at the start of the game. 
          2. OR Like we did in the demo, create a list of nine lists representing nine rooms. Collapse all possible things that can occupy a given list into one list per room. 
        • Other implementations are possible, but you must discuss them with Mr. Reiss or one of our class volunteers before implementation. 
        1. Implement left, right, up, and down commands. An alert message should be displayed if player runs into a wall or room does not have any stairs to go up or down.
        2. Implement while loop to request the next player command.
        Due Tuesday February 18, 2020 

          Milestone 2

        1. Pay attention: Name your file lastName_FirstName_proj2Monster-v02.py
        2. Implement quit and help commands
        3. Implement look command to display what is in the room (e.g. monster, sword, stairs, etc..)
         Due Thursday February 20, 2020 

          Milestone 3

        1. Pay attention: Name your file lastName_FirstName_proj2Monster-v03.py
        2. Create list inventory_list[ . , . ] .
        3. Implement grab command to place the grabbed item in your inventory and the item is removed from the room.
        4. Use the a_list.remove('item name') and a_list.append("item_name") methods to remove items from one list and them to another list..
        5. Implement inventory command to display the contents of your inventory.
          Due Friday February 21, 2020 

          Final Version

        1. Pay attention: Name your file lastName_FirstName_proj2Monster-Final.py
        2. Implement fight command to use the sword in your inventory to defeat the monster. If you don't have a sword, you get eaten when you try to fight or leave and display a You Lose and Gameover message!
        3. If you defeat the monster with a sword, monster disappears from room, and sword disappears from inventory.
        4. Implement Boss Monster for the win! Defeat the Boss Monster with a sword and magic stone.
        5. Then grab the Prize and display a You Win and Gameover message!
          Due Monday February 24, 2020 

        Tuesday, February 11, 2020

        Text-based Adventure Game

        Tuesday 2/11/20:  Project 2 Monster Adventure Game - Introduction

        Student will use knowledge of lists, Booleans, conditionals, and while loops to create a text-based monster adventure game.

        • Monster Game Adventure Demo: zorkonline.net
        1. This game will take place in a three story dungeon with 9 rooms.
        2. The user will have to traverse through the levels and find a way to fight monsters.
        3. On each move the user has seven possible actions: left, right, up, down, grab, look, inventory, fight, help and quit.
        4. If the move is invalid (not one of these options), the game should let the user know. Otherwise, the game will execute the user's move.
        5. The goal of the game is to reach the prize blocked by a boss monster.
         Due Before Class Friday February 14, 2020:
        •  Create a game board on PAPER. This is part of the requirement of the project. Turn in a picture of this board game into canvas.
        • Create pseudo-code of your game loop and code blocks on either paper or in a text editor. Turn into Canvas.   

        Monday, February 10, 2020

        2.7 Part 3 For loops and Lists


        Lesson 2.7 Lists Part 3: While Loops and For Loops   

        www.google.com Lab 2.7 Part 3 - Traversing and Setting up Tic-Tac-Toe

        1. Practice slicing, adding, and removing elements from some given lists;
        2. Create a single move Tic-Tac-Toe game
        3. Name your file Lab2.7_OneMoveTicTacToe.py
          Due Friday February 8, 2019 

        Thursday, February 6, 2020

        Warm-up    2.7 - slice, append, pop, remove

        • Debrief warm-up

        Lesson 2.7 Lists Part 2   

        1. Define and identify: slice, append, pop, remove;
        2. Slice a list;
        3. Add and remove elements from a list.
        • If you haven't already, read Section 2.5 List Operations
        • Slice Definition: Slicing is a list operation that gives back a list starting from the index to the left of the colon and going up to the index to the right of the colon. Note that slicing doesn't exist in Snap!
        • List Operation Summary Notes

        www.google.com Lab 2.7 - Traversing and Setting up Tic-Tac-Toe

        1. Practice slicing, adding, and removing elements from some given lists;
        2. Create a single move Tic-Tac-Toe game
        3. Name your file Lab2.7_OneMoveTicTacToe.py
          Due Friday February 8, 2019 

        Blog information move to Google Doc

        Hello All, Moving forward, please find all information about the class that you used to find on a live google doc agenda. The link is foun...