1.3 The Python Programming Language

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Computers can only execute programs that are written in what?

Low-level languages (or machine languages, same thing)

What is byte code interpreted by?

A program called virtual machine

What are almost all programs written in and describe.

Almost all programs are written in high-level languages. Low-level languages are used only for a few specialized applications.

What is a small disadvantage of programs written in high-level languages?

Because they have to process this processing takes time, but they have tons of enormous advantages.

What is it called the language after being compiled into a lower level language?

Byte code

What processes does Python use?

Byte code and virtual machine, but because of the way programmers interact with it, it is usually considered an interpreted language

What are some other high-level programming languages?

C++, PHP, and Java

What is a way that your operating system and other programs identify a file as containing python code?

Files that contain Python code have names that end with .py Example: $ python firstprogram.py My first program adds two numbers, 2 and 3: 5

Is it easier to program in high-level of low-level languages?

High-level languages

In what case do you have a source code, object code, executor, and output?

In the case of a compiler. They read the program and translate it completely before the program starts running. The high-level program is called the source code, the translated program is called the object code or executable. Once a program is compiled, you can execute it repeatedly without further translation. source code --> compiler --> object code --> executor --> output

What is often referred to as a source code?

Instead of working directly in the interpreter you can write an entire program by placing lines of Python instructions in a file and then use the interpreter to execute the contents of the file as a whole. Such a file is a source code. Example: If we used a text editor to create a source code file named firstprogram.py with the following contents: print("My first program adds two numbers, 2 and 3:") print (2 + 3)

What are two kinds of programs that process high-level languages into low-level languages?

Interpreters and compilers

What is the difference between a high-level programming language and a low-level programming language?

It is high-level if the program must be processed before it can run, and low-level if the computer can execute it without additional processing.

What is assembly language?

It uses a slightly easier format to refer to the low level instructions

Why is working directly in the interpreter convenient?

It's convenient for testing short bits of code because you get immediate feedback. Think of it as scratch paper used to help you work out problems.

What are low-level languages also referred to as?

Machine languages or assembly languages

What programming language will we learn?

Python

What is a compiler?

Reads the program and translates it completely before the program starts running.

What are the type ways to use the Python Interpreter?

Shell mode and program mode

What is machine language?

The encoding of instructions in binary so that they can be directly executed by the computer

What is a >>> used for?

The interpreter uses the prompt to indicate that it is ready for instructions. So with this: $ python3 Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 2 + 3 5 >>> We typed 2+3 and the interpreter evaluated our expression and replied 5. On the next line it gave a new prompt indicating that it is ready for more inpuut.

What does it means when a language is portable?

They can run on different kinds of computers with few or no modifications

Describe low-level languages and it's portability.

They can run on only one kind of computer and have to be rewritten to run on another.

What are interpreters?

They read a high-level program and execute it, meaning that it does what the program says. It processes the program a little at a time, alternately reading lines and performing computations. Source code --> Interpreter --> output

Why is it easier to program in high-level languages than low-level languages?

They take less time to write, they are shorter and easier to read, and they are more likely to be correct. They are also portable.

What type of programs have to be processed before they can run?

Those written in high-level languages (and even those in assembly language)

What is shell mode?

You type Python expressions into the Python shell, and the interpreter immediately shows the result. It would be like this $ python3 Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 2 + 3 5 >>>

What is Python an example of?

a High-level language

What is a >>> called?

the Python prompt.

Source code is another name for:

the instructions in a program, stored in a file


Set pelajaran terkait

DIGESTIVE SYSTEM (ABDOMINAL ORGANS)

View Set

Proportions in Triangles (Assesment)

View Set

7 Characteristics of Living Things- Biology

View Set