User Tools

Site Tools


roger:apcs-bpc

This is an old revision of the document!


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>!”.

bpc-1a


print("Hello, my name is Mr. Appledog!")

Now I explain what this does and add;

bpc-1b


name = "Appledog"

print("Hello, my name is Mr. " + name + "!")

So the key is we need to add the name:

bpc-1c


name = input("What is your name? ")

print("Hello, my name is Mr. " + name + "!")

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:


roger/apcs-bpc.1694516342.txt.gz · Last modified: 2023/09/12 10:59 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki