This document discusses variables, data types, expressions, and functions in Python. It defines a variable as a name that represents a stored value in memory. It describes different data types in Python including integers, floats, strings, Booleans, and others. It also discusses expressions, which represent computations that evaluate to a value, and different expression types like arithmetic, relational, logical, and compound expressions. Finally, it introduces functions as blocks of code that perform tasks and can return values.
Python is a popular programming language used in a variety of applications, including data analysis, web development, and artificial intelligence. Here's an introduction to the Basics of Python - A Beginners Guide! Whether you're new to programming or looking to brush up on your skills, this video covers the basics of Python programming language. From data types and operators to loops, functions and libraries, you'll get a solid foundation to start coding in Python.
Visit us: https://www.elewayte.com/
Python is a popular programming language used in a variety of applications, including data analysis, web development, and artificial intelligence. Here's an introduction to the Basics of Python - A Beginners Guide! Whether you're new to programming or looking to brush up on your skills, this video covers the basics of Python programming language. From data types and operators to loops, functions and libraries, you'll get a solid foundation to start coding in Python.
Visit us: https://www.elewayte.com/
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
More Related Content
Similar to TOPIC-2-Expression Variable Assignment Statement.pdf
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
3. A variable is a name that represents a value
stored in the computer memory.
Location in memory where value can be
stored
3
4. A variable name is any valid identifier that is not a
Python keyword.
A variable name can not contain spaces.
A first character must be characters or an
underscore ( _ ).
Cannot begin with digit
After first character, the digits 0 through 9 can be
used.
Case sensitive. Uppercase and lower case are
distinct. This means the variable name ItemOrdered
is not the same as itemordered.
Choosing meaningful identifiers helps make a
program self-documenting.
4
5. Variable Name Legal or Illegal
Units_per_day Legal
dayOfWeek Legal
3dGraphic Illegal. Variable name cannot
begins with digit
June1997 Legal
Mixture#3 Illegal. Variable name may only use
letters, digits, or underscore
5
6. The variable name begins with lowercase
letters.
The first character of the second and
subsequent words is written in Uppercase
◦ grossPay
◦ payRate
◦ averageOfNumbers
6
7. Assignment operator =
Assigns value on right to variable on left.
Number1 = 45
Number2 = 72
Sum = Number1 + Number2
>>> print(Number1)
45
>>> print(Number2)
72
>>> print(Sum)
117
Note: Variable can not be used until it is assigned a value
7
9. There are some words that are reserved by
Python for its own use. You can't name variable
with the same name as a keyword. To get a list of
all the keywords, issue the following command
>>> import keyword
>>> keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'break',
'class', 'continue', 'def', 'del', 'elif', 'else', 'except',
'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is',
'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return',
'try', 'while', 'with', 'yield']
9
10. If you give the statement to python to
evaluate,
>>> x=6
It will associate the value of the expression on
the right hand side with the name x.
An assignment statement has the following
form:
variable_name = expression
10
11. Python evaluates an assignment statement
using the following rules
◦ Evaluate the expression on the right hand side of
the statement. This will result in a value.
◦ Store the id in the variable.
You can now reuse the variable
>>> x=9
>>>x*8
72
11
12. As the name indicates, Python variables can be
readily changed. This means that you can
connect a different value with a previously
assigned variable very easily through simple
reassignment.
Knowing that you can readily and easily reassign
a variable can also be useful in situations where
you may be working on a large program that was
begun by someone else and you are not clear yet
on what has already been defined.
See related shell examples
12
13. With Python, you can assign one single value
to several variables at the same time.
This lets you initialize several variables at
once, which you can reassign later in the
program yourself, or through user input.
>>> x = y = z = 0
>>> j , k , l = ‘shark’ , 2.5 , 5
13
14.
15. Computers manipulate data values that represent
information and these values can be of different types.
In fact, each value in a Python program is of a specific
type.
The data type of a value determines how the data is
represented in the computer and what operations can be
performed on that data.
A data type provided by the language itself is called a
primitive data type.
Python supports quite a few data types: numbers, text
strings, files, containers, and many others.
Programmers can also define their own user-defined
data types, which we will cover in detail later.
15
17. Expressions are representation in text of
some form of computation.
Expressions are distinguished by the fact that
when you evaluate (perform the represented
computation) you end up with a resultant
value.
>>> 5
5
>>> 5+6
11
17
18. An expression that represents the resultant
internal value that it generates inside the
interpreter. 10 is a primitive expression 10 +
10 is not.
Numerical Data Types -- int, float, complex
◦ See Shell for examples
Strings
◦ "your name“
18
22. The precedents of math operators from
highest to lowest is
◦ Exponentiation **
◦ Multiplication, Division, Remainder *, /, //, %,
◦ Addition and subtraction +, -
22
29. Expression Value of the Expression
True and False False
False and True False
False and False False
True and True True
Expression Value of the Expression
True or False True
False or True True
False or False False
True or True True
Expression Value of the Expression
not True False
Not False True
29
30. A Boolean expression is an expression that
evaluates to True or False
>>> 4 > 2
True
>>> 4 < 2
False
30
31. True and False are not strings, they are
special values that belong to the type bool
>>> type(True)
<class 'bool'>
>>> type(4 < 2)
<class 'bool'>
31
32. How do you explain this?
>>> False or 1
1
>>> True and 0
0
32
33. To understand this behavior you need to
learn the following rule:
“The integer 0, the float 0.0, the empty string,
the None object, and other empty data
structures are considered False; everything else
is interpreted as True"
33
34. When an expression contains And or Or,
Python evaluates from left to right
It stops evaluating once the truth value of the
expression is known
◦ For x and y, if x is False, there is no reason to
evaluate y
◦ For x or y, if x is True, there is no reason to
evaluate y
The value of the expression ends up being
the last condition actually evaluated by
Python
34
35. Try to evaluate the value of the following
expressions
◦ 0 and 3
◦ 3 and 0
◦ 3 and 5
◦ 1 or 0
◦ 0 or 1
◦ True or 1 / 0
35
36. In the following expression, which parts are
evaluated?
◦ (7 > 2) or ( (9 < 2) and (8 > 3) )
◦ A. Only the first condition
◦ B. Only the second condition
◦ C. Only the third condition
◦ D. The first and third conditions
◦ E. All of the code is evaluated
36
37. What is the output of the following code?
a = 3
b = (a != 3)
print(b)
A. True
B. False
C. 3
D. Syntax error
37
38. Consider the following expression:
(not a) or b
Which of the following assignments makes
the expression False?
A. a = False; b = False
B. a = False; b = True
C. a = True; b = False
D. a = True; b = True
E. More than one of the above
38
39. Consider the following expression:
a and (not b)
Which of the following assignments makes the
expression False?
A. a = False; b = False
B. a = False; b = True
C. a = True; b = False
D. a = True; b = True
E. More than one of the above
39
40. What happens when we evaluate the
following?
>>> 1 or 1/0 and 1
When expressions involve Boolean and & or
operators, short circuiting is applied first and
then precedence is used.
What is the value of the following expression?
>>>1 or 1/0
40
41.
42. function is a collection of programming
instructions that carry out a particular task.
For Example: Print function to display
information.
There are many other functions available in
Python.
Most functions return a value. That is, when the
function completes its task, it passes a value
back to the point where the function was called.
42
44. Print function is a piece of prewritten code that
performs an operation. Python has numerous
built-in functions that perform various
operations.
Print(“Hello World”)
In interactive mode, type this statement and press
the Enter key, the message Hello world is
displayed.
Here is an example:
>>> print('Hello world')
Hello world
>>>
44
45. Python also allows you to enclose string literals in triple
quotes (either """ or ' '). Triple-quoted strings can
contain both single quotes and double quotes as part of
the string.
45
47. Comments are notes of explanation that
document lines or sections of a program.
Comments are part of the program, but the
Python interpreter ignores them. They are
intended for people who may be reading the
source code.
In Python, comment begin with the # character.
When the Python interpreter sees a # character, it
ignores everything from that character to the end
of the line.
47
49. Python built-in functions to read input from
the keyboard.
Variable = input(prompt)
x= input("Enter First Number : ")
name = input(“Whats is your Name : ")
49
50. >>> name = input(“ What is your Name : ")
What is your Name : Ahmed
>>> print(name)
Ahmed
50
51. Input function always returns user input as a
string, even if the user enter numeric data.
Use data conversion function.
51
53. >>> x= float(input("Enter First Number : "))
Enter First Number : 10
>>> y= float(input("Enter second Number : "))
Enter second Number : 3
>>> z= float(input("Enter Third Number : "))
Enter Third Number : 5
>>> print("The maximum value is : ", max(x,y,z))
The maximum value is : 10.0
53
54. An expression that is formed by combining
multiple expressions together.
For example 4 + len("abc") is a compound
expression formed from a primitive
expressions ('4') and a function call
expression (len("abc")) using the addition
operator.
See shell for related examples
54
55. Go over sections 2.1, 2.2 and 2.5 of the
Textbook.
55