User Tools

Site Tools


apcs-bpc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
apcs-bpc [2023/09/15 05:50] – created appledogapcs-bpc [2023/09/15 05:58] (current) appledog
Line 7: Line 7:
 Write a program that asks for your name, and then prints "Hello, Mr. <name>!". Write a program that asks for your name, and then prints "Hello, Mr. <name>!".
  
-=== Step One: print() +=== Step One: Basic Output 
-<Code:Python|bpc-1a>+In python, the basic output is print()
 + 
 +<Code:Python|print-1a.py>
  
 print("Hello, my name is Mr. Appledog!") print("Hello, my name is Mr. Appledog!")
Line 14: Line 16:
 </Code> </Code>
  
-Now I explain what this does and add;+This allows you to print messages to the console.
  
-<Code:Python|bpc-1b>+Now lets explore what a variable is. 
 + 
 +<Code:Python|print-1b.py>
  
 name = "Appledog" name = "Appledog"
  
 print("Hello, my name is Mr. " + name + "!") print("Hello, my name is Mr. " + name + "!")
 + 
 </Code> </Code>
  
-So the key is we need to add the name:+Here we store some information and use it later. We store the name "Appledog" in a variable called "name". You could also call the variable "x", or any other word.
  
-<Code:Python|bpc-1c>+=== Step Two: Basic Input 
 + 
 +<Code:Python|print-1c.py>
  
 name = input("What is your name? ") name = input("What is your name? ")
  
 print("Hello, my name is Mr. " + name + "!") print("Hello, my name is Mr. " + name + "!")
 + 
 </Code> </Code>
  
-This is the final version of the instruction program. Now we ask Roger to write a new program: Input your first name and last name, and write "Hello <firstname> <lastname>!"+This is the final version of the instruction program. Now we ask the students to write their own program:
  
-This is the program he wrote:+=== Problem 1 
 +Problem 1Input your first name and last name, and write "Hello <firstname> <lastname>!"
  
-<Code:Python>+==== Answer 
 + 
 +<Code:Python|print-1d.py>
  
 a = input("What is your first name? ") a = input("What is your first name? ")
-= input("What is your last name? ")+= input("What is your last name? ")
  
 print("Hi, Mr. " + a + " " + c + ".") print("Hi, Mr. " + a + " " + c + ".")
 + 
 </Code> </Code>
  
 Mark: 100% Mark: 100%
  
-Comment: Roger got the right answer, but I had to tell him to fix the English formattingincluding to add a space between a + cAfter he changed it to + " " + c the program was acceptable for APSC. I'll give him the 100% for now, but otherwise a program with a missing space is at best 90% or 93%.+Comment: Many students don't format the English correctlyor forget to include a space between the two wordsIn such case they should lose 5% for the mistake. 
apcs-bpc.1694757026.txt.gz · Last modified: 2023/09/15 05:50 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki