Input and Output - Programming Basics - KS3 Computer Science Revision - BBC Bitesize
Input and Output - Programming Basics - KS3 Computer Science Revision - BBC Bitesize
KS3
Programming basics
Input and output
Programming is writing computer code to create a
program, in order to solve a problem. To program a
computer, you need to know how programs are
constructed.
Save to My Bitesize
Revise Test
Pages
Arithmetic
Variables
Naming variables
Data input
Programs are written to solve problems. To solve a problem, a program
needs data input and data, or information, output.
side_length = 5
perimeter = side_length * 4
print(perimeter)
The data in the variable ‘side_length’ has been hard coded, ie it has been
written directly into the program. If we wanted to change this data, we would
have to go back and change the program.
This time, the data for the variable ‘side_length’ is input by the user when the
program is running. The statement ‘input’ is used to tell the computer that
the user must enter some data before the program can continue.
Data output
Once data has been processed, programs often need to output the data they
have generated. In Python, the ‘print’ statement is used to output data.
Consider this Python (3.x) program for calculating the perimeter of a square:
Related links
Jobs that use Computer Science BBC Click BBC Technology news
Language:
English
Terms of Use About the BBC Privacy Policy Cookies Accessibility Help Parental Guidance
Contact the BBC Get Personalised Newsletters Why you can trust the BBC Advertise with us
© 2024 BBC. The BBC is not responsible for the content of external sites. Read about our approach to external
linking.