Posts

Showing posts with the label basics

Variable & Data Types (Session 3)

 Variable: A variable is a name given to a memory location in a program.  Variables do not need to be declared with any particular  type , and can even change type after they have been set. For example: a = 28 b =21.26 c ="Mustajab" In short, we can say that here variable is a container to store a value . Example: x = 28 y =  "Mustajab" print (x) print (y) Here Mustajab is str type and 28 is int type. Many Values to Multiple Variables: Python allows us to assign values to multiple variables in one line: x, y, z =  "Student1" ,  "Student2" ,  "Student3" print (x) print (y) print (z) Rules for defining a variable name:  A variable name can contain alphabets, digits, and underscore. A variable name can only start with an alphabet and underscore. A variable can’t start with a digit. No white space is allowed to be used inside a variable name. Task : Read about Whitespace Characters in Python. Data Type: Python is a great language that...

Python Basics (Introduction)

Image
What is Programming? Just like we use Urdu or English and other languages to communicate with each other, we use a Programming language to communicate with the computer. Programming is a way to instruct the computer to perform various tasks. What is Python: Python is a simple and easy-to-understand language that feels like reading simple English.  It works on Pseudo code nature which makes it easy to learn and understandable for beginners. Features: Easy to understand = Less development time Free and open source High-level language Portable – works on Windows/Linux/Mac Syntax: The syntax of the Python programming language is  the set of rules which defines how a Python program will be written.  Python is a friendly language. It has a simple and easy-to-learn syntax. Moreover, its features are easy to use, which allows you to write short and readable code. While,  C++ is a bit complex when it comes to the simplicity of language, and it has more syntax rules. What is P...