ProgrammingTutorial

Python Programming for S3: Output, Variables & Input

By the end of this video your will be able to write python code for output, input, variables and concatenation.

  1. Python Programming for S3 – Getting Started
  2. Python Programming for S3: Output, Variables & Input
  3. Python Programming for S3 – Working with Variables

A Teaching Tutorial by Mr Neil, Computer Science teacher at Beeslack High School.

Introduction

In his tutorial video Mr Neil covers:

  • The role of programming in how a computer works.
  • How to write Python code for:

Tutorial

From 0m:27s: Mr Neil explains the core principles of software, that of Input: Data is collected and sent to the computer, which Processes that information in some way, and information is then Output: Presenting the results of the processing back to the user.

From 0m:57s: He begins first with Output, explaining that Python uses the print command[1]https://realpython.com/python-print/ to show information to the user, with the output wrapped within brackets and text signified through quotation marks.


print ("Hello World")

From 2m:28s: Here Mr Neil wants the user to pause the video and conduct their own work, tasking the learner to:

  1. Create a repl called ‘Output, Variable, Input’.
  2. Add an output statement to your program that will display the message ‘This is my first Python Program’.
  3. Add an output statement to your program that will display your name.

From 2m:57s: Mr Neil then focuses on Python variables[2]https://realpython.com/python-variables/, explaining the rules governing their use.

From 3m:32s: He demonstrates how to use variables within Repl, achieved simply through typing the variable, in this case calling it ‘name’, and assigning it a value through an equals sign:


name = "Mr Neil"

and that it can be displayed to the user via the print command:


print(name)

and that text and variables can be combined together (concatenation) to customize what is displayed:


print("Hello " + name + ". Nice to meet you!")

From 4m:49s: He then pauses the video and sets the learner a task to try out their own version of this process.

From 5m:27s: Mr Neil then explains Input, which is achieved simply through the Python input command[3]https://pynative.com/python-input-function-get-user-input/. When run this prompts the user to enter some information, and assigns that to the variable, with text added to explain the input being sought:


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

From 7m:00s: Mr Neil sets the final task 3 for the learner, for them to define a routine to ask a user for their favourite food, and finishes the video by providing his own version of this that the learner can compare their work to.

References

References
1 https://realpython.com/python-print/
2 https://realpython.com/python-variables/
3 https://pynative.com/python-input-function-get-user-input/

Related Articles

One Comment

Leave a Reply

Your email address will not be published.

Back to top button