This document provides an introduction and overview of using Python for AI with examples of using the IDLE and PyCharm editors to write and run Python code. It discusses basic Python concepts like variables, data types, operators, control flow statements, functions and libraries. It provides examples of arithmetic expressions, conditional statements, loops and drawing basic shapes with code. It also contains questions to test understanding of key Python concepts covered.
Helpmeinhomework Experts provides the most trusted and reliable online Programming assignment help . Programming is one of the most widely taught subjects across the universities. The complexity of subjects make students seek for quality and affordable online guidance. We at helpmeinhomework.com Experts cater to such needs of the students. Our programming experts provide assignment help to students across UK, USA and Australia for multiple programming languages i.e. Java, Python, HTML, PHP, Assembly language, C ,Linux ,Unix etc.
This file contains the first steps any beginner can take as he/she starts a journey into the rich and beautiful world of Python programming. From basics such as variables to data types and recursions, this document touches briefly on these concepts. It is not, by any means, an exhaustive guide to learn Python, but it serves as a good starting point and motivation.
Helpmeinhomework Experts provides the most trusted and reliable online Programming assignment help . Programming is one of the most widely taught subjects across the universities. The complexity of subjects make students seek for quality and affordable online guidance. We at helpmeinhomework.com Experts cater to such needs of the students. Our programming experts provide assignment help to students across UK, USA and Australia for multiple programming languages i.e. Java, Python, HTML, PHP, Assembly language, C ,Linux ,Unix etc.
This file contains the first steps any beginner can take as he/she starts a journey into the rich and beautiful world of Python programming. From basics such as variables to data types and recursions, this document touches briefly on these concepts. It is not, by any means, an exhaustive guide to learn Python, but it serves as a good starting point and motivation.
Kosmik is the best institute for Python training in Hyderabad Kukatpally/KPHB. kosmik provides lab facilities with complete real-time training with live sessions
call now: +91-8712186898, +91-8179496603, +91-6309565721
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014
LESSON 2. CONDITIONAL LOGIC, IF ELSE STATEMENTS, SELECTION, DEBUGGING
Introduction to, with examples, conditional logic and the use of IF and ELSE statements. Look at SELECTION in game design. Learn about Debugging and Error Checking. Analyse the use of a flow chart and how to design before implementation. Discuss: Video gaming addiction! Create a password checker and a username and password (login) app. Learn about the use of ELIF. Learn about Boolean variables and their use. Learn about Multiple comparisons using and/or. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section. Discussion on Artificial Intelligence and Robotics.
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Lucky Gods
Ready to Unleash Your Python Power?
Tired of coding in the dark? Feeling lost in a sea of syntax errors? Well, ditch the frustration and dive headfirst into Python mastery! This book is your ultimate passport to programming paradise, packed with 100+ solved and commented exercises that'll turn you from coding rookie to confident Python pro in no time!
Imagine:
Cracking the code like a ninja: Demystifying variables, functions, loops, and more!
Conquering challenges with ease: Solving real-world problems with your newfound Python skills!
Leveling up your game: Mastering advanced concepts like data analysis and machine learning!
Sharing your Python prowess: Dazzling everyone with your coding superpowers!
This book is your roadmap to Python success:
Spark your coding curiosity: Ignite your passion for programming with engaging explanations and real-world examples.
Master the fundamentals: Build a solid foundation in Python syntax, data types, and control flow.
Practice makes perfect: Tackle 100+ challenges of varying difficulty, with clear explanations for every step.
Level up your skills: Dive deeper into object-oriented programming, data analysis, and beyond!
So, what are you waiting for? Grab this book, unlock the power of Python, and watch your coding dreams come true!
Python is a high-level, object-oriented, interpreted programming language, which has garnered worldwide attention. Stack Overflow found out that 38.8% of its users mainly use Python for their projects. According to the website’s survey, Python’s popularity surpassed that of C# in 2018 – just like it surpassed PHP in 2017. On the GitHub platform, Python surpassed Java as the second-most used programming language, with 40% more pull requests opened in 2017 than in 2016. This makes Python certification one of the most sought-after programming certifications.
Today, Python is one of the most popular programming languages. Although it is a general-purpose language, it is used in various areas of applications such as Machine Learning, Artificial Intelligence, web development, IoT, and more.
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON Nandakumar P
Unit 1 : INTRODUCTION TO PROBLEM SOLVING, EXPRESSION AND DATA TYPES
Fundamentals: what is computer science - Computer Algorithms - Computer Hardware - Computer software - Computational problem solving using the Python programming language - Overview of Python, Environmental Setup, First program in Python, Python I/O Statement. Expressions and Data Types: Literals, Identifiers and Variables, Operators, Expressions. Data types, Numbers, Type Conversion, Random Number.
Problem solving: Restaurant Tab calculation and Age in seconds.
إذا كُنت من هواة البرمجة ولم تُحلّق في هذا العالم بعد فالطريق ما زال مفتوحًا أمامك، فالفضاء موجود أمامك لتختار أحد المسارات وتسلكها فورًا.
اختيار المسار بحد ذاته هو الحاجز الذي نقف عنده في الغالب، بل ويستغرق وقتًا أطول من وقت التعلّم والمُمارسة، لكن ليس هُناك أجمل من الاستفادة من التقنيات الموجودة بين أيدينا حاليًا لتطوير أدوات نستطيع الاستفادة منها.
لمزيد من المعلومات اشتركوا في قائمتنا البريدية:
https://www.apptrainers.com/
Kosmik is the best institute for Python training in Hyderabad Kukatpally/KPHB. kosmik provides lab facilities with complete real-time training with live sessions
call now: +91-8712186898, +91-8179496603, +91-6309565721
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014
LESSON 2. CONDITIONAL LOGIC, IF ELSE STATEMENTS, SELECTION, DEBUGGING
Introduction to, with examples, conditional logic and the use of IF and ELSE statements. Look at SELECTION in game design. Learn about Debugging and Error Checking. Analyse the use of a flow chart and how to design before implementation. Discuss: Video gaming addiction! Create a password checker and a username and password (login) app. Learn about the use of ELIF. Learn about Boolean variables and their use. Learn about Multiple comparisons using and/or. Includes a suggested videos, ‘Big ideas’ discussion, and HW/research projects section. Discussion on Artificial Intelligence and Robotics.
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Lucky Gods
Ready to Unleash Your Python Power?
Tired of coding in the dark? Feeling lost in a sea of syntax errors? Well, ditch the frustration and dive headfirst into Python mastery! This book is your ultimate passport to programming paradise, packed with 100+ solved and commented exercises that'll turn you from coding rookie to confident Python pro in no time!
Imagine:
Cracking the code like a ninja: Demystifying variables, functions, loops, and more!
Conquering challenges with ease: Solving real-world problems with your newfound Python skills!
Leveling up your game: Mastering advanced concepts like data analysis and machine learning!
Sharing your Python prowess: Dazzling everyone with your coding superpowers!
This book is your roadmap to Python success:
Spark your coding curiosity: Ignite your passion for programming with engaging explanations and real-world examples.
Master the fundamentals: Build a solid foundation in Python syntax, data types, and control flow.
Practice makes perfect: Tackle 100+ challenges of varying difficulty, with clear explanations for every step.
Level up your skills: Dive deeper into object-oriented programming, data analysis, and beyond!
So, what are you waiting for? Grab this book, unlock the power of Python, and watch your coding dreams come true!
Python is a high-level, object-oriented, interpreted programming language, which has garnered worldwide attention. Stack Overflow found out that 38.8% of its users mainly use Python for their projects. According to the website’s survey, Python’s popularity surpassed that of C# in 2018 – just like it surpassed PHP in 2017. On the GitHub platform, Python surpassed Java as the second-most used programming language, with 40% more pull requests opened in 2017 than in 2016. This makes Python certification one of the most sought-after programming certifications.
Today, Python is one of the most popular programming languages. Although it is a general-purpose language, it is used in various areas of applications such as Machine Learning, Artificial Intelligence, web development, IoT, and more.
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON Nandakumar P
Unit 1 : INTRODUCTION TO PROBLEM SOLVING, EXPRESSION AND DATA TYPES
Fundamentals: what is computer science - Computer Algorithms - Computer Hardware - Computer software - Computational problem solving using the Python programming language - Overview of Python, Environmental Setup, First program in Python, Python I/O Statement. Expressions and Data Types: Literals, Identifiers and Variables, Operators, Expressions. Data types, Numbers, Type Conversion, Random Number.
Problem solving: Restaurant Tab calculation and Age in seconds.
إذا كُنت من هواة البرمجة ولم تُحلّق في هذا العالم بعد فالطريق ما زال مفتوحًا أمامك، فالفضاء موجود أمامك لتختار أحد المسارات وتسلكها فورًا.
اختيار المسار بحد ذاته هو الحاجز الذي نقف عنده في الغالب، بل ويستغرق وقتًا أطول من وقت التعلّم والمُمارسة، لكن ليس هُناك أجمل من الاستفادة من التقنيات الموجودة بين أيدينا حاليًا لتطوير أدوات نستطيع الاستفادة منها.
لمزيد من المعلومات اشتركوا في قائمتنا البريدية:
https://www.apptrainers.com/
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.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
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.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
_PYTHON_CHAPTER_2.pdf
1. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
8
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Python programs can used to write and run through the many editor software. But, what we
are considering here IDLE and PyCharm editor software. mhs;ka jevigyka fndfyda editor
uDÿldx. yryd ,sùug yd l%shd;aul lsÍug Ndú;d l< yelsh' kuq;a" wms fuys i,ld n,kafka
IDLE editor iy PyCharm uDÿldx.hhs.
IDLE editor is lightweight, simple, and provides basic functionality such as syntax highlighting
in shell and Python files.
To use IDLE, simply install Python and type “IDLE” into your operating system search bar.
This should work for Linux, Mac, and Windows operating systems.
If you want to execute a small program or script with one or two files using default libraries,
You can use the IDLE project.
If you want to execute a larger program and use different external dependencies specifically for
this project, You can use PyCharm with a virtual environment to handle the different libraries.
02
IDLE Software - Integrated DeveLopment Environment
IDLE kñka yeÈkafjk interactive mode fhdod .ksñka l%shd;aul
jk integrated development environment uDÿldx.h" edit, run browse
and debug lrñka programs ,sùu fuys § isÿ lrkq ,nhs'
How to open IDLE application
2. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
9
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
The >>> is called the Python prompt, The interpreter uses the prompt to indicate that it is ready
for instructions.
">>>" - ixfla;h u.ska python command (úOdkhla& wfmalaId lrk nj weÕùu isÿ lrkq
we;'
How to use Python to show “Hello world “.
How to use Python to calculate 2+2
We typed 2 + 2, and the interpreter evaluated our expression, and replied 4, and on the next line
it gave a new prompt, indicating that it is ready for more input.
We type Python expression / statement / command after the prompt and Python immediately
responds with the output of it. Let's start with typing print “How are you” after the prompt.
>>>print (“How are you?”)
How are you?
Write and run Python program via PyCharm Software
Let’s do the coding to show the output of “Hello world “. This “Hello world “ is string data type.
This sentence is an instruction(one), which contains a single statement. The statement is ‘write
the words’.
In Python (3.x), the equivalent statement is print.
print("Hello world")
How to input print command.
3. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
10
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
How to Run the Application.
How to see the Output.
Activity-1
What we get is Python’s response. We may try the following and check the response:
(i) print (5+7) (ii) 5+7 (iii) 6*250/9 (iv) print (5-7)
It is also possible to get a sequence of instructions executed through interpreter.
(v) A cinema is offering discount tickets to anyone who is under 15. Decomposing this problem,
gives this algorithm:
1. find out how old the person is
2. if the person is younger than 15 then say “You are eligible for a discount ticket.”
3. otherwise, say “You are not eligible for a discount ticket.”
4. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
11
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Note the similarities between the flowchart and pseudocode, and the finished program.
Now we are good to write a small code on our own in Python, While writing in Python,
remember Python is case sensitive. That means x & X are different in Python. tkï
jevigykla ,sùfï § x iy X w;r fjki b;d jeo.;a fõ'
fuu software tl ;=,ska bj;a ùug wjYH kï"
Keyboard ys we;s Ctrl+D press lsÍfu fyda
quit ^& f,i lsÍu yryd th l%shd;aul lr .; yelsh (used to leave the interpreter).
Algorithm would look like this:
OUTPUT "How old are you?"
INPUT User inputs their age STORE the user's input in the age variable
IF age < 15 THEN OUTPUT "You are eligible for a discount.
"ELSE OUTPUT "You are not eligible for a discount."
In a flowchart, this algorithm would look like this:
Creating the program in Python
A Python (3.x) program to meet this
algorithm would be:
age = int(input("How old are you?"))
if age < 15:
print("You are eligible for a discount.")
else:
print("You are not eligible for a discount.")
Drawing a Shape
fuys § úúO yev;, mß.Klh ;=, o¾Ykh lr .ekSu i|yd Python Ndú;hg .kq ,nhs'
Following example is giving you to understand how to display a triangle.
Input Output
5. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
12
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Keywords in Python
They are the words used by Python interpreter
to recognize the structure of program. As these
words have specific meaning for interpreter,
they cannot be used for any other purpose.
Statements in Python
Different programming languages
use different statements. A few of
these are listed in this table. úúO
l%uf,aLk NdId úúO m%ldY Ndú;d
lrhs' fïjdhska lsysmhla fuu
j.=fõ ,ehsia;= .; lr we;'
Statement Purpose
print Output a message on the screen
input Get data from the user
if…else A decision
while A loop controlled by a decision
for A loop controlled by a counter
def Create a procedure or function
Operators and Operands
Operators are special symbols which represents computation
(.Kkh lsÍu ksfhdackh lrk úfYaI ixfla;). They are applied
on operand(s), which can be values or variables. Same
operator can behave differently on different data types. Operators
when applied on operands form an expression.
Operators are categorized as Arithmetic, Relational, Logical and
Assignment. Value and variables when used with operator are
known as operands.
6. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
13
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Basic arithmetic ^wxl .Ks;h&
Arithmetic is used all the time in computer programs, so an understanding of how computers
use arithmetic is useful' mß.Kl jevigyka j, wxl .Ks;h ks;ru Ndú;d lrhs" tneúka
mß.Kl wxl .Ks;h Ndú;d lrk wdldrh ms<sn| wjfndaOhla m%fhdackj;a fõ'
This table lists the common arithmetic processes with their programming equivalents.
Arithmetic process Programming equivalent
Addition (plus) +
Subtraction (minus) -
Multiplication *
Division /
Activity2
Do the following mathematical examples in Python (3.x).
(i) >>> print(5 + 7)
12
(ii) >>> print(7 - 5)
2
(iii) >>> print(5 * 7)
35
(iv) >>> print(35 / 7)
5.0
More complicated calculations:
(v) >>> print((5 * 2) + (4 - 3))
11
(vi) >>> print((8 / 4) + (2 - 1))
3.0
Mathematical/Arithmetic Operators
Python Numbers
Two primary (m%d:ñl) types of numbers mhs;ka Ndú;hg .kq ,nhs.
• Integers (whole numbers fyj;a iïmQ¾K ixLHd, including negatives, like 7, -9, or 0)
• Floating point numbers (numbers with decimals, like 1.0, 2.5, 0.999, or 3.14159265)
Python Operators
The math symbols (.Ks; ixfla;) like + (plus) and - (minus) are called operators because they
operate, or perform calculations, on the numbers in our equation.
7. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
14
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Relational Operators
Logical Operators
Symbol Description
or If any one of the operand is true, then the condition becomes true.
and If both the operands are true, then the condition becomes true.
not Reverses the state of operand/condition.
Example:
8. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
15
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Python Indentation
Most of the programming languages like C, C++, and Java use braces { } to define a block of
code. Python, however, uses indentation.
A code block (body of a function, loop, etc.) starts with indentation and ends with the first un-
indented line. The amount of indentation is up to you, but it must be consistent throughout that
block.
Generally, four whitespaces are used for indentation and are preferred over tabs. Here is an
example.
Python Comments
Comments are very important while writing a program. They describe what is going on inside a
program, so that a person looking at the source code does not have a hard time figuring it out.
You might forget the key details of the program you just wrote in a month's time. So taking the
time to explain these concepts in the form of comments is always fruitful.
In Python, we use the hash (#) symbol to start writing a comment.
It extends up to the newline character. Comments are for programmers to better understand a
program. Python Interpreter ignores comments.
for i in range(1,11):
print(i)
if i == 5:
break
The enforcement of indentation in Python makes the code look neat and clean. This results in
Python programs that look similar and consistent. Python ys bkafvkafÜIka n,d;aul lsÍu fla;h
ms<sfj<g iy meyeÈ,s fmkqula we;s lrhs' fuys m%;sM,hla f,i mhs;ka jevigyka iudk iy ia:djr f,i
o¾Ykh jkq we;'
9. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
16
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
Answer all the questions.
1. What is a variable?
1. A box(memory location) where you store values 2. a type of graphics
3. Data type 4. a type of memory
2. What symbol is used in python to assign values to a variable?
1. equals = 2. plus +
3. forward slash / 4. asterisk *
3. What will be the output?
name = "Dave"
print (name)
1. Dave 2. 'Dave' 3. name 4. (name)
4. What is Python?
1. text based programming language 2. word processor
3. spreadsheet 4. block based programming language
5. What is Algorithm?
1. Fixing bugs 2. Functions
3. A sequence of instructions 4. Game design
6. Fixing errors in programming is called ...
1. Optimization 2. Debugging
3. Looping 4. Cleaning
7. A command that lets us repeat an action multiple times in your code
1. Algorithm 2. Loop 3. Variable 4. Method
8. Which line of code is used to make a loop?
1. for i in range(5) 2. # Code normally executes in the order it's written.
3. hero.build("upArrow") 4. a = "door"
9. Find the object in the following code:
helper.build("upArrow")
1. helper 2. build() 3. upArrow 4. hero
10. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
17
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
10. Find the argument in the following code:
hero.moveUp(4)
1. hero 2. moveUp() 3. 4 4. Up()
11. Find the method in the following code:
hero.use("door")
1. hero 2. use() 3. door 4. " "
12. Which python operator means 'less than or equal to'?
1. >= 2. > 3. < 4. <=
13. Python uses indentation to block code into chunks
True False
14. A syntax error means your code has a 'grammar' mistake or you used symbols/operations
incorrectly
True False
15. Which statement correctly assigns the string "Tanner" to the variable name?
1. name = print( "Tanner") 2. input("Tanner")
3. name = "Tanner" 4. name = input("Tanner")
16. Draw with python shape as below,
17. Draw with python shape as below,
11. mhs;ka NdIdj iuÕ lD;%su nqoaêh - AI with Python Language
18
Dishant Yapa | 077 295 3717
www.srilankarobotics.lk
18. Enter the following expressions and see the result,
>>> 2 + 3 * 6
20
>>> (2 + 3) * 6
30
>>> 48565878 * 578453
28093077826734
>>> 2 ** 8
256
>>> 23 / 7
3.2857142857142856
>>> 23 // 7
3
>>> 23 % 7
2
>>> (5 - 1) * ((7 + 1) / (3 - 1))
16.0
>>> 'Alice' * 5
'AliceAliceAliceAliceAlice'