Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Resturant Bill Calculator
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Mary Clair Wright, NBCT
You Belong in the Room
List of Standards Taught and Assessed with this Curriculum
This is the AP CSP Convesion from a Proficiency Grade to Numeric Grade
These materials developed by code.org
Watch this video to get an overview of Machine Learning and AI
No work your way through these activities
Variables: dedicated memory to store data. Named by the programmer, the name serves as a reference point or provides directions for the program to the values stored
Today we are going to use the python visualizer so that you can "see" the memory!
To display information on the screen (or console) to the user we will uses the print
command
ACT: 24-27 practice using academic and content-specific terms
When you are finished - compose 3-5 complete senctence response to each prompt using college level techncial writing and submit according to your instructions
A string in Python is a sequence of characters. It is a derived data type. Strings are immutable. This means that once defined, they cannot be changed
How can we make a new line, like hitting the enter key when typing?
If you see this character in a string, that means that the current line ends at that point and a new line starts right after it
Strings and Variables
Write a python function named pasttense
that accepts a string called verb
as an input and displays the original verb and the verb with an "ed"
added onto the end. See the function header and sample output below.
Download the .txt file with the starter code - copy and paste that into the IDE - then using the examples, build and test your procedure.
Finally - have the following calls
Turn it in according to instructions
1.2 Escape Sequences
create a variable called firstLetter
and store the first letter of your last name as a string. The print the value stored is first letter surrounded by '. For example, I would display 'W'
print
“Practice is not the thing you do once you are good. It is the thing you do that makes you good.” - Malcolm Gladwell Note: you need to display the “ “.
display your first name and last name on one line together with your date of birth on another line and indented using only one print
command
create a function called yearAgan(y)
that accepts the numeric year (for example "1985") as the input y
and prints the following "It is 1985 all over again"
Write one print
statement that produces the following output:
create a function spikey()
that has no value passed in, but when it is called produces the following output. Each line of output should be its own print
command.
Your code should have at least four comments that explain the purpose of a function, variable or command statement . Programming convetion dictatest that all of your procedures should be together (at the top of the program file) and your procedure calls should be together at the bottom of the file.
There is no starter code or txt file for this - you are starting from a blank page in a visualizer.
When you are finished - upload your .txt file to the assignment in schoology.
integers - whole numbers (positive and negative)
floats - numbers with decimals
type - returns the data type of a variable
1.1 Making HMTL Tags
Functions can accept more than one paramenter. For example
However - the order the strings are entered matters. We must follow the pattern or order created in the definition of the function
Each print()
command does two things: displays a value to the user AND moves the cursor down to the next line
However - we can modifiy the end of our print command
Explain the output that you can see.
So what does , end =
do??
So far we have been joining strings using the +,
but for a print statement we can display more than one piece of data without having to join.
Consider this output from the visualizer
We are no longing combining strings to create a new string - we are displaying different data types and commands to the user by connecting pieces with a ,
So if we ask a user to enter a number - the comptuer store that value as a STRING - and we cannot do math with Strings.
So how can we tell the computer that we want the value to be an integer?
Below is an example - but you can create your own. Be sure to #comment the introductionary section. Should your chatbot have a name or a personality?
This is Eliza - the very first chatbot
While this is just an example - it does have a plan psuedocoded for you. Make sure to do comments to identify this section
Go crazy and add some oneline ascii art to your chatbot or use ++,==,--, or other symbols to drawn lines on the screen to seperate different parts of your user experience.
Use your math coding skills to guess the users age
Notice this is nicely psuedocoded out for you - and there are awesome examples of HOW to comment - go crazy and follow the directions.
Notes Together
Typically, we we ask the user to enter data - we will store that value in a variable
Notice that the user can see the question and their response on the console AND that the value stored in name defaults to a string
Variable Basics
Python KeyWords that cannot be used as variable names
We use camelCasing for variable names with more than one word
Create a custom goodbye that
Verse by Verse
One area where AI and machine learning are making strides is in the study of semantics, word choice, and language.
Visit this website and create at least a 6 line poem (any type and any muse)
Follow directions for submission
Your first major project will be a chatbot - you will simulate a converstation with a user by collecting information and building responses. Because this is a Unit 1 assignment there will not be any error checking - we will assume the user enters the correct information when prompted.
In codingrooms - open the assignment and make sure you are working on the chatBot.py file!
Pick two topics and continue your conversation. Below is a sample conversation about animals - you may NOT use animals as one of your topics - but I wanted to give you an example
Major Assessment
While psuedocode is an informal language - we need some basic structure to make it easier to read, easier to use, and easier to share with a fellow programmer
For this class - we will use spacing / indentation as a baseline for organizination
Example:
Images and details adapted from:
1.2 Understand the software development life-cycle.
Here are the four basic turtle movements - you should reconzige them as the AP CSP Robot Grid Movemements
What is the deal with the options? Python was built as a learning or teaching language. That means they built in some flexability when it comes to syntax.
Your assignment - turn in a scan of your notes from today with the psuedocode of how to draw the letter x using only these 4 commands and your brain
We control the turtle by giving it instructions. Before we go on - review these basic turtle functions()
Forgot how to make a new turtle?
Want to change the turtle's shape?
To print the current location (x,y coordinates) of your turtle
Learning the functions and syntax in text based language is NOT the hard part. Writing efficient algorithims to solve a problem is the hard part because it requires abstract thinking about both the problem and the possible solution.
Before we start programming, either creatively or to solve a problem, we should plan or visualize our program code. We can use this plan to develop specific instructions for the computer
We can use flowcharts or psuedoce in planning - in this class we will focus more on psuedocode. However, visual thinkers should feel free to use flowcharts if they produce better investigative thinking or program design. Programming styles are individual!
One component of AI is the attempt to replicate human emotion. So we want to include emotions in the conversation - but your chatbot does not have the ability to make a learned response based on the users input so you have to be generic.
Why is it called a turtle?
The turtle robot, a simple robot controlled from the user's workstation that is designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body
A drawing turtle is going to have three attributes a location, an orientation (or direction), and a pen. The pen will have its own attributes: color, width, and on/off state.
When we program with a turtle, we are using body syntonic reasoning - in other words - we can predict and reason about the turtles movements by imagining what we would do if we were the turtle.
This is sequential code! One line executes AFTER the one before it has finished.
The # are programmer comments that clarify the action
Mock is the name of the object we created (mock is an instance of the turtle) and we are calling the method/function/procedure of forward. These methods already exist in the Python library.
The 100 is the value passed into the method as an argument. - allowing us to use this method for any number of steps we want the turtle to take.
Right now - our chatbot doesn't have any options on what to respond. But - could you had some pauses, or some other output phrases that indicate "thinking"
Can you insert a knock knock joke?
Can you make your chatbot overly friendly? rude? nosy?
Have the Turtle Write Your 3 Initials. If you have more than 3 - you may overachieve or drop one. If you have less than 3 you may add your favorite letter!
Because we all have different screen sizes - if you don't think your grid is lining up the way you like - you can check your own screen size
Check out the cheat sheet~
Programming the turtle u move forwards and/or backwards and turn different angles;
Changing the pen colour, fill colour, background colour, and/or pen size;
Using loops to avoid unnecessary repetition of code;
Using variables to store and reuse information;
Descriptive or clarifying comments
At least three different outputs/flowers
Performing mathematical calculations with code;
Using Nested Loops
Using more than one turtle
Draw this Shape: Square Logo
Draw This Shape: Overlapping Squares