Podcast
Questions and Answers
What does Python use instead of brackets?
What does Python use instead of brackets?
What is the recommended number of spaces to use for indentation in Python?
What is the recommended number of spaces to use for indentation in Python?
What command can be used to run a Python script called app.py?
What command can be used to run a Python script called app.py?
What tool can be used to check Python code for compliance with PEP8?
What tool can be used to check Python code for compliance with PEP8?
Signup and view all the answers
What is the command to install pycodestyle using pip?
What is the command to install pycodestyle using pip?
Signup and view all the answers
What does PEP stand for?
What does PEP stand for?
Signup and view all the answers
What is the presence requirement for lectures in this course?
What is the presence requirement for lectures in this course?
Signup and view all the answers
What type of test can be expected in the final exam?
What type of test can be expected in the final exam?
Signup and view all the answers
What is the minimum score required to pass the final exam?
What is the minimum score required to pass the final exam?
Signup and view all the answers
How can students access valuable books for this course?
How can students access valuable books for this course?
Signup and view all the answers
What is the policy on cheating and plagiarism in labs?
What is the policy on cheating and plagiarism in labs?
Signup and view all the answers
What is the requirement for lab completion?
What is the requirement for lab completion?
Signup and view all the answers
How can students select their institution in Safari Books Online service?
How can students select their institution in Safari Books Online service?
Signup and view all the answers
What is the consequence of cheating in the course?
What is the consequence of cheating in the course?
Signup and view all the answers
What is the feature of Python environment that makes it a 'batteries included' environment?
What is the feature of Python environment that makes it a 'batteries included' environment?
Signup and view all the answers
What is the purpose of the 'pip' command in Python?
What is the purpose of the 'pip' command in Python?
Signup and view all the answers
What is the main difference between IPython and Jupyter Notebook?
What is the main difference between IPython and Jupyter Notebook?
Signup and view all the answers
What is the purpose of the 'conda' command in Anaconda?
What is the purpose of the 'conda' command in Anaconda?
Signup and view all the answers
What is the extension of a Python file?
What is the extension of a Python file?
Signup and view all the answers
What is the purpose of the 'shebang' line in a Python file?
What is the purpose of the 'shebang' line in a Python file?
Signup and view all the answers
What is the feature of IDLE that makes it a good Integrated Development Environment (IDE)?
What is the feature of IDLE that makes it a good Integrated Development Environment (IDE)?
Signup and view all the answers
What is the difference between Python and IPython?
What is the difference between Python and IPython?
Signup and view all the answers
What is the main difference between Jupyter Notebook and Python?
What is the main difference between Jupyter Notebook and Python?
Signup and view all the answers
What is the purpose of the 'pylint' command in Python?
What is the purpose of the 'pylint' command in Python?
Signup and view all the answers
What is the syntax to print a statement in Python2?
What is the syntax to print a statement in Python2?
Signup and view all the answers
What is the data type of a complex number in Python?
What is the data type of a complex number in Python?
Signup and view all the answers
What is the purpose of the input function in Python?
What is the purpose of the input function in Python?
Signup and view all the answers
What is the keyword used to define a function in Python?
What is the keyword used to define a function in Python?
Signup and view all the answers
What is the purpose of the return keyword in Python?
What is the purpose of the return keyword in Python?
Signup and view all the answers
What is the purpose of the pass keyword in Python?
What is the purpose of the pass keyword in Python?
Signup and view all the answers
What is the purpose of the range function in Python?
What is the purpose of the range function in Python?
Signup and view all the answers
What is true about everything in Python?
What is true about everything in Python?
Signup and view all the answers
What is the main purpose of Python Enhancement Proposals (PEPs)?
What is the main purpose of Python Enhancement Proposals (PEPs)?
Signup and view all the answers
Which of the following is a characteristic of Python as a dynamically-typed language?
Which of the following is a characteristic of Python as a dynamically-typed language?
Signup and view all the answers
What is the principle of Python design that states 'Readability counts'?
What is the principle of Python design that states 'Readability counts'?
Signup and view all the answers
What is the output of the code print("Hello, {}!".format("World"))
?
What is the output of the code print("Hello, {}!".format("World"))
?
Signup and view all the answers
What is an advantage of Python being a multi-paradigm language?
What is an advantage of Python being a multi-paradigm language?
Signup and view all the answers
What is the main difference between Python and Java?
What is the main difference between Python and Java?
Signup and view all the answers
What is the error in the code 2 + '2'
?
What is the error in the code 2 + '2'
?
Signup and view all the answers
What is the purpose of the print()
function in Python?
What is the purpose of the print()
function in Python?
Signup and view all the answers
Study Notes
Course Introduction
- Course title: Script Languages (W04IST-SI4011)
- Faculty: Faculty of Information and Communication Technology
- Department: Department of Applied Informatics
- Teachers: Wojciech Thomas, PhD
- Course completion conditions: Get passing grades from lab exercises, pass the final exam, and follow the cheating and plagiarism policy
Lecture and Lab Completion
- Lecture activities: Ad hoc, random, and no negative points
- Lab completion conditions: Presence is obligatory, create a user account in Safari Books Online, follow the cheating and plagiarism policy, and demonstrate ability to explain code and write clean code
Python Resources
- Python DOCS: https://www.python.org/doc/
- Recommended books: Learning Python, Impractical Python Projects, and Automate the Boring Stuff with Python
- Python flavors: Python, IPython, Jupyter Notebook, and Anaconda
Python Environment
- Python is a "batteries included" environment with a distribution made by Python developers
- Dependency management with pip: pip install, pip install --upgrade, and python -m pip install --upgrade pip
- IPython adds extra functions to Python shell, including syntax highlighting, help, variables introspection, magic commands, and TAB completion
Python Code File
- Python files use .py extension
- On Windows, .py extension suggests a tool to run the code
- On Linux/iOS, you need to add a "shebang" line: #!/usr/bin/python
- You can run an app using py: py app.py
Code Layout and Style
- Python uses indentation instead of brackets
- It is advised to use spaces instead of Tabs
- pycodestyle checks your code for compliance with PEP8
- Install pycodestyle with pip: pip install pycodestyle
PEP
- PEP ≡ Python Enhancement Proposal
- A set of documents describing new functions proposals, guidelines, and process descriptions
- PEP20 (The Way of Python) includes 20 principles of Python design
Multi-Paradigm Language
- Python is a multi-paradigm language, allowing structured, object-based, and functional programming
- Python is dynamically-typed, but strongly-typed language
Variables and Output
- Python is dynamically-typed: >>> id = 12, >>> type(id), >>> id = "ad3ez79", >>> type(id)
- print is a function used to output data: >>> print("Hello!"), >>> print("Hello, {}!".format("World"))
- input is a function to read data from input: >>> name = input("Please, type your name:")
Basic Types
- Integer: int, bool
- Floating point: float (double precision)
- Complex numbers: complex (e.g., z: z.real and z.real)
- String: a sequence type (see: next lecture)
Conditions and Functions
- if keyword executes part of the code conditionally
- return keyword returns the result of the function
- def keyword defines a function: def sum(a, b): return a+b
Loops and Objects
- for keyword loops through the values
- range function generates a list of numbers
- Everything in Python is an object, including functions, values, types, and classes
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Learn the basics of Python scripting language in this course for students of Department of Applied Informatics. Understand the fundamentals of Python programming and its applications.