Python 3: Basic Concepts

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What symbol is used to perform Exponentiation?

**

What is the most widely used version

CPython

Python was mainly developed for emphasis on ____ ___________, and its syntax allows programmers to express concepts in _____ lines of code.

Code readability, fewer

T/F: Switching between versions of Python is not recommended and very difficult

F - It isn't hard to change from one version to another.

T/F: All versions of Python prior to version 3 are obsolete.

F - both Python Version 2.x and 3.x are used currently.

T/F: Python recognizes comment symbols and runs them to generate output

F - no output will be generated and comment symbols are only used for making notes in code

Python is a programming language that lets developers work quickly and _________ _______ more efficiently.

Integrate systems

Are Scripting Languages compiled or interpreted?

Interpreted

When entering calculations into Python, do you need to enter spaces around the operations?

No, but the spaces around the plus and minus signs here are optional (the code would work without them), but they make it easier to read.

Can you divide by 0 in Python?

No; dividing by zero in Python produces an error, as no answer can be calculated.

T/F: all scripting languages are programming languages

True

The language is high in demand because it provides _________ __________ ___________ like Django for web development and Pandas for data analytics

extensive support libraries

To determine the quotient and remainder of a division, use the _____ _______ and ______ _________, respectively.

floor division, modulo operators

In using simple operations in Python, what symbol does the language use to indicate division?

/

How is the Floor Division operator done?

//

In using simple operations in Python, what symbol does the language use to indicate multiplication?

*

What is CPython?

- it's an implementation - written in C - CPython is a source code interpreter

What datatype is produced in Python when you divide two integers?

A float

What is the interpreter?

A program that runs scripts written in an language such as Python

T/F: Floor Division and Modulo operators don't work with either floats or integers.

F - These operators can be used with both floats and integers

What datatype is used to represent numbers that are NOT integers?

Floats are used in Python to represent numbers that aren't integers

Scripting Language vs. Programming Language

In a simple manner, a programming language is an artificial language which allows communicating between instructions and machine (computer) while a scripting language is a form of programming language which helps to control one or multiple applications without the need of compilation.

Which type of program needs to be compiled before running?

Programming Languages

Python is a:

Python is a Scripting Language. It's a standalone program that does not load any external module, library function or program and is designed to boot with the bootstrap procedure of the target processor.

T/F: - When working with Floats in Python, extra zeros at the number's end are ignored

T

T/F: Floats may cause bugs in your program

T

Why is it named Python?

When he began implementing Python, Guido van Rossum (Python inventor) was also reading the published scripts from "Monty Python's Flying Circus", a BBC comedy series from the 1970s. Van Rossum thought he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python.

Why can a float be added to an integer?

because Python silently converts the integer to a float.

In programming, what is a Float?

it's a number with a decimal point such as 5.0

Python supports multiple programming paradigms, like _____________, ___________, and _____________ or ________________

object-oriented, imperative and functional programming or procedural.

T/F: An integer is produced when running an operation on two floats

F - a float is produced by running an operation on two floats

What type of number is produced in the Python output if one uses a single forward slash ( / ) to perform a division operation?

Using a single slash to divide numbers produces a decimal

What symbol is used to indicate comments in a program?

#

How is the Modulo Operator carried out in Python?

%

What is a Scripting Language?

- A scripting language is nothing but a programming language which does not require a clear compilation step - For example, when you run C program, you need to compile it first, but when you run a JavaScript, then you don't need to do this. So, we can say that the JavaScript is a scripting language.

What is Python?

- High-level programming language - applications used in numerous fields, including web programming, scripting, scientific computing, and artificial intelligence

How does Python execute code?

- It's processed at runtime by the interpreter - no need to compile your program before executing it

How is Python different from other languages?

- Python is a widely used high-level, general-purpose, interpreted, dynamic programming language - Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.

Why is Python a more approachable language to learn than others?

- Python is an easy to learn, powerful programming language. - It has efficient high-level data structures and a simple but effective approach to object-oriented programming. - Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

Why are Compiled Programs faster than Interpreted Programs?

- because compilers read and analyze the code only once, and report the errors collectively that the code might have, - but the interpreter will read and analyze the code statements each time it meets them and halts at that very instance if there is some error

What's the difference between programming language and script?

- scripting languages are processed at runtime - No compilation required.

What line of the code can you find the error's type?

- the last line of an error message indicates the error's type - read error messages carefully, as they often tell you how to fix a program!

What are the 2 ways to create floats in Python?

- they can be created directly by entering a number with a decimal point - or by using operations such as division on integers

Are there different versions of Python?

- yes; the three major versions of Python are 1.x, 2.x and 3.x. - these are subdivided into minor versions, such as 2.7 and 3.3.

Why start with Python 3 instead of another version?

Because code written for Python 3.x is guaranteed to work in all future versions.

Why can using Floats be problematic in programming?

Because computers can't store floats perfectly accurately, in the same way that we can't write down the complete decimal expansion of 1/3 (0.3333333333333333...)

T/F: Python does NOT have the capability of carrying out calculations?

F - Using simple operations in Python is possible. Enter a calculation directly into the Python console, and it will output the answer.

T/F: Scripting Languages require the compilation step.

F - they do not require the compilation step and are rather interpreted

T/F: Python has very few and limited implementations.

F - Python has several different implementations, written in various languages.

Summary and conclusion of Scripting Languages

In summary, scripting languages are easy-to-write, doesn't need compilation, and runs inside other application or program. In the advanced technical world, scripting languages are used to design complex software and programs. While the programming languages like C, Java, etc. run in a parent program and are still widely used in a traditional manner to build the full versions of applications and software. They can be used on any platform.

T/F: A float is also produced by running an operation on a float and an integer.

T

T/F: Generally, compiled programs run faster than interpreted programs.

T - because they are first converted native machine code


Kaugnay na mga set ng pag-aaral

CHAPTER 49: DRUG THERAPY WITH OPIOIDS

View Set

1st Prof Ethics Quiz (Overview of the Theories, etc)

View Set

PEDs Chapt 15 Nursing Care of the Child with an Infectious or Communicable Disorder

View Set