User Tools

Site Tools


roger:apcs-bpc

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
roger:apcs-bpc [2023/09/12 11:07] appledogroger:apcs-bpc [2023/09/15 05:47] (current) – removed appledog
Line 1: Line 1:
-= Basic Programming Concepts 
-* for Roger 
  
-We need to understand basic programming concepts like input and output. 
- 
-Problem 1: Write a program that asks for your name, and then prints "Hello, Mr. <name>!". 
- 
-<Code:Python|bpc-1a> 
- 
-print("Hello, my name is Mr. Appledog!") 
- 
-</code> 
- 
-Now I explain what this does and add; 
- 
-<Code:Python|bpc-1b> 
- 
-name = "Appledog" 
- 
-print("Hello, my name is Mr. " + name + "!") 
- 
-</Code> 
- 
-So the key is we need to add the name: 
- 
-<Code:Python|bpc-1c> 
- 
-name = input("What is your name? ") 
- 
-print("Hello, my name is Mr. " + name + "!") 
- 
-</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 program he wrote: 
- 
-<Code:Python> 
- 
-a = input("What is your first name? ") 
-c = input("What is your last name? ") 
- 
-print("Hi, Mr. " + a + " " + c + ".") 
- 
-</Code> 
- 
-Mark: 93% 
-Comment: Roger got the right answer, but I had to tell him to fix the English formatting, including to add a space between a + c. After he changed it to a + " " + c the program was acceptable for APSC. 
roger/apcs-bpc.1694516845.txt.gz · Last modified: 2023/09/12 11:07 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki