Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.

Similar presentations


Presentation on theme: "COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions."— Presentation transcript:

1 COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions with parameters in your programs. LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions with parameters in your programs.

2 Python is a freely available programming language. You can write Python code in notepad, or any other simple text editors - but it is easier if you use a program like IDLE ( named after Eric Idle (Monty Python!))

3 You can type simple commands at the prompt (>>>). Try typing: /4 3*7 Check that the answers are correct! Quick note: you are going to be making lots of Python programs. Create a Python folder somewhere so that you can save your files here!

4 Hello World in INTERACTIVE MODE We can put simple instructions into the IDLE window, but we can’t write and save complex programs. Open IDLE and look for the chevrons >>> Simply type the following (exactly): print(“Hello, World”) Now press Enter! The main IDLE window should show you your output: Well done! You’ve written your first program!

5 Save your program as MyFirstProgram in your PYTHON folder. (Simply go to File menu….Save As….) TO Open the PYTHON program, find the file in your PYTHON folder. Right-click the file From the pop-up menu, select EDIT with IDLE Make sure you are comfortable with opening and saving a Python program. >>> print"Hello World" >>> print("Hello World"); >>> Print("Hello World") >>> print("Hel World") >>> prin(Hello World) Which one of these will output the following ? >>> Hello World By the way… you can use “speech marks” or ‘apostrophes’ for words (strings) Both will work!

6 Hello World in SCRIPT MODE Another way we can write code in PYTHON is by using SCRIPT mode. This is useful when you are working with many lines of code. Open IDLE and click the FILE menu option. Select NEW WINDOW - this will give you a new window that you can use to write and save your programs! In this new window, type the following (exactly): print(“Hello, World”) Save this file in your Python folder (call it “hello world again.py”) and then press F5 to run it. The main IDLE window (>>>) should show you your output: Congratulations! You have written a Python program!

7 Task 1: Create a program in python that outputs the following… KEEP CALM AND LEARN PYTHON If you can, do all these programs in SCRIPT mode (i.e. go to FILE, NEW WINDOW…then press F5 to run) Task 2: Create a program in python that outputs the following… I love Python and right now I’m learning to program! Task 3: Create a program in python that outputs the following… * ** *** **** ***** **** *** ** * Save as ‘ KeepCalm.py ’ Save File again! What does \n do?

8


Download ppt "COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions."

Similar presentations


Ads by Google