0% found this document useful (0 votes)
15 views

Variables, Expressions Statements and Conditional Satatements

The document discusses fundamental programming concepts like variables, values, types, statements, and operators. It defines a variable as a name that refers to a value and notes they can be integers, strings, floats or other types. Assignment statements are used to create and initialize variables. Print statements display the value of a variable. Operators perform computations on operands, or values.

Uploaded by

sonal singhal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Variables, Expressions Statements and Conditional Satatements

The document discusses fundamental programming concepts like variables, values, types, statements, and operators. It defines a variable as a name that refers to a value and notes they can be integers, strings, floats or other types. Assignment statements are used to create and initialize variables. Print statements display the value of a variable. Operators perform computations on operands, or values.

Uploaded by

sonal singhal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Variables, Expressions

Statements and
conditional Satatements
Values and types
Value: A value is one of the basic things a program works
with, like a letter or a number. For example: The
values are 1, 2, and “Hello, World!”
Types: These values belong to different types: 2 is an
integer, and “Hello, World!” is a string.
1. Integer : Int
2. String : Str (make sure that it is in
quotes, works for both single or double
quotes)
3. Float : float
If you are not sure what type a value has, the interpreter can tell you
Variables
Variable: A variable is a name that refers to a value.
An assignment statement creates new variables and gives them values:

To display the value of a variable, you can use a print statement:


Variable names and keywords
• They can contain both letters and numbers, but they cannot start
with a number.
• The underscore character ( _ ) can appear in a name. Variable
names can start with an underscore character.
• Variables name can not be reserved keywords in Python
Statements
• A statement is a unit of code that the Python interpreter can execute.
• We have seen two kinds of statements: print being an expression
statement and assignment.
Operators and operands
• Operators are special symbols that represent computations like
addition etc.
• The values the operator is applied to are called operands

You might also like