Python Programming Basics and Why You Should Learn It

Slide Note
Embed
Share

"Discover what Python is, its versatile applications, why it's a popular choice for developers, and how to start exploring this programming language. Learn about Python's syntax, flexibility across different platforms, and its ease of use for various development tasks."


Uploaded on Oct 07, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Lecture 5 1

  2. What is Python? Python is a popular programming language. It was created in 1991 by Guido van Rossum. It is used for: web development (server-side). software development,GUI Mathematics. system scripting. Networks 2

  3. What can Python do? Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development. 3

  4. Why Python? Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). Python has a simple syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick. Python can be treated in a procedural way, an object-orientated way or a functional way. 4

  5. Try It Out! Download Python from www.python.org Any version will do for this class By and large they are all mutually compatible Recommended version: 2.7 or 3.7 Use IDLE if you can 5

  6. Programming basics code or source code: The sequence of instructions in a program. syntax: The set of legal structures and commands that can be used in a particular programming language. output: The messages printed to the user by a program. console: The text box onto which output is printed. Some source code editors pop up the console as an external window, and others contain their own console window. 6

  7. Compiling and interpreting Many languages require you to compile (translate) your program into a form that the machine understands. compile execute source code Hello.java byte code Hello.class output Python is instead directly interpreted into machine instructions. interpret source code Hello.py output 7

  8. The Python Command Line to test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file. This is made possible because Python can be run as a command line itself. Type the following on the Windows, Mac or Linux command line: C:\Users\Your Name>python From there you can write any python, including our hello world example from earlier in the tutorial: 8

  9. Python Variables variable: A named piece of memory that can store a value. Usage: Compute an expression's result, store that result into a variable, and use that variable later in the program. assignment statement: Stores a value into a variable. Syntax: name = value Examples: x = 5 gpa = 3.14 x 5 gpa 3.14 A variable that has been given a value can be used in expressions. x + 4 is 9 Exercise: Evaluate the quadratic equation for a given a, b, and c. 9

Related