Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Programming. Declarative programming Procedural / Functional Programming Object Orientated Programming Event Driven Programming Python 3.3 We will be using Python 3.3 to learn the basic of programming and then have look at other languages if there is time. We will be using the IDLE Interface Python 3.3 Programming involves using a set of instructions, data and keywords to tell the computer what to do. Your first program type and then press enter >>> print(“Hello World”) Python 3.3 Which one of these is correct? >>> print"Hello World“ >>> print("Hello World"); >>> Print("Hello World") >>> print("Hel World") >>> prin(Hello World) Where do you look for errors? 1) Syntax Errors 2) Logical errors Python 3.3 Task Using a script – create a program that produces three lines of text. Python 3.3 Special characters in text \n Creates a line in a string of text \t Creates a tab style indent in a string of text \\ Allows a backslash to appear in a string of text \” Allows a speech mark to be used in a string of text Python 3.3 Variables Variables are containers that can hold data. In most languages variables are declared to be a certain data type first such as Strings, Integers, Dates, Real, Characters etc.. In python variables are declared when they have their first value assigned to them Python 3.3 Variables Try the following program print("Hello this is a variable program") name = "" name = input("Enter in your name please: ") print("Hello ", name) Python 3.3 Variables You can use variables to do calculations Try this program print("Hello this is a variable program") num1 = 0 num2 = 0 sum = 0 num1 = int(input("Enter in number 1 please: ")) num2 = int(input("Enter in number 2 please: ")) sum = num1 + num2 print("The total is ",sum) Python 3.3 Tasks 1) Write a program that will read in three integers and display the sum. 2) Write a program that will read in two integers and display the product. 3) Enter the length, width and depth of rectangular swimming pool. Calculate the volume of water required to fill the pool and display this volume.