[Go to site: main page, start]

0% found this document useful (0 votes)
11 views4 pages

Installing Python for Engineering Programming

Uploaded by

valer93979
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Installing Python for Engineering Programming

Uploaded by

valer93979
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

0 - Welcome to Introduction to Engineering Programming

Installing Python on your computer


Option 1: Python interpreter & IDE
• Go to [Link]

• Click on the Download Python [Link] button near the top of the page

• An installer will be downloaded to your computer

• Run the installer and follow the prompts to install Python on your computer

• It is recommended that you also install an IDE, preferably Microsoft Visual Studio Code.

• To do so, go to [Link]

• Download the appropriate installer for your operating system

• Follow the prompts of the installer to set it up on your computer.

• You are now ready to work with Python on your computer!

Option 2: Python's Scientific Computing package


Initial Anaconda/Spyder IDE installation/setup
Install Anaconda on your computer. Ensure Spyder and Jupyter is properly setup and working. You can confirm by running the customary first program in a new programming language.

On Jupyter, Then click Run or press Ctrl+Enter

Congratulations, you're now a Python programmer! It is clear that there's significantly less code to write to print out a statement in Python than in several other languages like C or C++!
On Spyder,

Then press Enter

Option 3: Python in the browser


You can also run Python in your browser on any device: personal computers, tablets, as well as mobile phones

• Go to [Link]

• Login to with your Google account.

• Click on New Notebook and start writing Python code!


What is a computer program
A computer program is a set of instructions to a computer which is typically designed to perform a specified task.

Note: It is possible, and even customary to design the set of steps that are involved in performing a specific task before implementing the steps in a programming language. This concerns the design of algorithms. An
algorithm is a set of commands that are followed for a computer to perform a specific task.

Programming languages
A computer program is written using a computer programming language. So a computer programming language is simply a language/system of notations for writing computer programs.

Examples of programming languages?

Classification of programming languages Programming languages can be classified into low-level programming languages and high-level programming languages .

A low-level programming language is programming language is used to write computer programs that the target computer's processor can understand. Low-level languages are also known as machine language. The
drawback of machine code/language is that they are written specifically for a particular computer processor and will not work on any other type of computer processor.

Assembly language is also considered to be low-level. Here, some abstraction is possible and groups of machine code instructions can be invoked with a single command in assembly code. Assemblers are used to
convert assembly-language programs to machine language.

With the advent of assembly languages, the use of computers increased rapidly. However, programmers still had to use numerous instructions to accomplish even simple tasks.

High-level languages were developed in which single statements could accomplish substantial tasks. High-level language allow you to write instructions that look almost like everyday English and contain common
mathematical notations. It is important to note that high-level languages still needs to be converted to machine code for the computer to understand them. Depending on the language, there are two ways this is
achieved:

• Some languages use translator programs called compilers to convert high-level language code into machine language. Typically, for languages that use compilers, the translation to machine code is done
before the code is run. Such languages are referred to as compiled languages. Example of compiled languages include: Rust, C, C++, C#, Go, etc.
• Compiling a large high-level language program into machine language can take considerable computer time. Some languages support interpreters, which execute high-level language programs directly (on a line-
by-line basis). Interpreters avoid compilation delays but your code runs slower than compiled programs. Languages that support interpreters are called interpreted languages. Examples of interpreted languages
include: Python, R, JavaScript, etc.

The Basics of Python (Student's part)


At this point, we're ready to begin to study the basics of Python.

• What is Python?
• Coding style and language ethos

What is Python?
Python is a general-purpose programming language that supports many programming paradigms, such as object-oriented programming, functional programming, and procedural programming. Python is an interpreted
language, which means that programs written in it do not need to be compiled before running, as is common in C and C++.

Question: What are programming paradigms?

Python is the dominant language in the field of artificial intelligence and machine learning. It is also very popular in other fields of computing, such as data analytics, data science, web development, and increasingly in
Python is the dominant language in the field of artificial intelligence and machine learning. It is also very popular in other fields of computing, such as data analytics, data science, web development, and increasingly in
embedded systems development (microcontrollers use a flavor of the language known as MicroPython). A solid understanding of Python would be very beneficial to an engineer looking to explore several exciting
emerging fields in technology. The instructor recommends that students continue striving to gain mastery of the language beyond the scope of this course.

The Next Class


Students taking this course will be expected to attend the next class with their computers, ready to program in Python

Welcome to ECE 272!

In [ ]: import this

The Zen of Python, by Tim Peters

Beautiful is better than ugly.


Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Lecture Schedule
Tuesdays: 10AM-12PM

Thursdays: 11AM-12PM

Common questions

Powered by AI

High-level programming languages offer greater abstraction and ease of use compared to low-level programming languages. High-level languages allow programmers to write instructions that resemble everyday English and incorporate mathematical notations, making them easier to code and understand . They enable advanced features such as data abstraction and are portable across different types of hardware, unlike low-level languages which are often tied to specific machine architectures . Low-level languages, including machine and assembly languages, provide fine control over hardware but are complex and less portable as they require knowledge of the specific hardware they run on. This complexity can make low-level programming tedious and error-prone .

Compilers and interpreters differ fundamentally in their approach to converting high-level languages into machine code. Compilers translate the entire codebase into machine code before execution, creating standalone executables capable of direct execution by the system's hardware . This allows for optimized performance as the code is pre-processed to eliminate inefficiencies. However, this process can be time-intensive, especially for large programs, creating delays in the development pipeline . Interpreters, on the other hand, process the high-level code line-by-line at runtime, which facilitates immediate execution without pre-compilation steps. This can simplify the debugging and testing phase, allowing for rapid iteration . The trade-off is that interpreted code typically runs slower than compiled code due to ongoing translation during execution .

Programming paradigms have significantly contributed to Python's popularity and versatility. Python supports multiple paradigms, including object-oriented, functional, and procedural programming, which allows developers to choose the most suitable approach for their problem domain . This flexibility helps Python accommodate diverse software development needs, from simple scripts to complex systems. Object-oriented support enhances code reuse and organization, functional programming facilitates efficient data manipulation, and procedural programming offers an intuitive structure for linear workflows . These paradigms make Python adaptable across various applications, fostering its widespread adoption in industries ranging from web development to machine learning .

Python’s ease of use, characterized by its simple syntax and readability, makes it highly suitable for educational purposes, especially in introductory engineering programming courses. Python's code resembles pseudo-code, which helps beginners focus on learning programming concepts rather than intricate syntax . This simplicity encourages experimentation and reduces the learning curve associated with programming. Furthermore, Python's extensive documentation and community support provide rich resources for learners to tackle challenges independently . These factors make Python an effective teaching tool that empowers students to implement complex concepts relatively quickly .

Using an IDE like Visual Studio Code provides a robust local development environment that integrates seamlessly with the file system, enabling smoother version control and advanced debugging capabilities . It supports a wide range of extensions and tools that enhance productivity. However, it requires initial setup and manual installations, which might not be ideal for quick experiments or collaborative projects. In contrast, browser-based platforms like Google Colab eliminate setup time and allow for running Python scripts without local installations, facilitating easy collaboration and sharing with others via cloud services . While convenient, these platforms may be limited by internet dependency and lack some of the advanced features present in dedicated IDEs, such as debugging and offline development .

Python is considered a general-purpose language because it supports a wide range of programming paradigms, making it applicable to a broad spectrum of applications . Its versatility allows it to handle tasks from simple scripts to complex web and data applications. Python significantly dominates in fields like artificial intelligence and machine learning, owing to its powerful libraries like TensorFlow and PyTorch . Additionally, it is prevalent in data analytics and data science, web development using frameworks like Django and Flask, and increasingly in embedded systems with MicroPython . Its ease of learning and readability make Python an attractive choice for developers across various technological domains.

Python is classified as an interpreted language, meaning its code is executed line-by-line at runtime by an interpreter rather than being compiled into machine code before execution. This allows for faster development cycles since there is no need for a time-consuming compilation stage . However, this can result in slower execution speeds compared to compiled languages like C or C++, as the interpretation process can introduce overhead and the lack of optimization that a compiler may provide . Interpreted languages like Python offer flexibility and ease of debugging and testing, which is advantageous in rapid development scenarios .

The statement 'Readability counts' from the Zen of Python emphasizes the importance of writing clear, understandable code, which is crucial for software collaboration in large engineering teams. Readable code enhances communication among team members, who may join or leave the project at different stages. It facilitates easier code reviews, debugging, and future maintenance . When code is readable, it reduces the cognitive load on engineers, allowing them to efficiently understand and work on different parts of a project without extensive prior knowledge . This practice inherently supports continuous integration and agile development methodologies, where team members repeatedly modify and expand codebases .

The Zen of Python, authored by Tim Peters, is a collection of aphorisms that capture the philosophy of Python programming. It emphasizes principles such as simplicity, readability, and clarity over unnecessary complexity . Phrases like 'Beautiful is better than ugly,' and 'Readability counts,' encapsulate the ethos of designing clean and maintainable code . The Zen of Python advocates for one obvious way to do things, promoting consistency and reducing ambiguity in coding practices . These principles guide Python developers in writing code that is not only functional but also elegant and easy to manage.

A solid understanding of Python benefits engineers through its versatility and widespread application in emerging technology fields. Python's dominance in artificial intelligence and machine learning makes it essential for engineers working in these areas to process data and build models . Additionally, Python's presence in data analytics, web development, and embedded systems development enhances an engineer's capacity to contribute to multidisciplinary projects . Its ease of learning and expansive library ecosystem allows engineers to quickly adapt and innovate, providing valuable skills that align with technological trends and demands .

You might also like