SlideShare a Scribd company logo
Little Coder Program
by
What you’ve learned?
What is instructions?
How to give instructions sequentially to accomplish a task !
What is Computer programming ?
What are computer languages?
Start with PythonChapter 2
Python
– Python is a computer language which is very easy
to learn and can be used to give instructions to a
computer
Setting up python environment in Windows
1. Goto http://www.python.org/ and download the latest
Windows installer
2. for Python 3. Look for a section in the menu titled Quick
Links,
3. The exact version of Python that you download is not
important, as long as it starts with the number 3.
4. After you download the Windows installer, double-click its icon,
and then follow the instructions to install Python in the default
location, as follows:
i. Select Install for All Users, and then click Next.
ii. Leave the default directory unchanged, but note the name of the
installation directory (probably C:Python31 or C:Python32).
Click Next.
iii. Ignore the Customize Python section of the installation, and
click Next.
• At the end of this process, you should have a Python 3 entry in
your Start menu:
Setting up the environment in MAC
1. Go to http://www.python.org/getit/ and download the latest installer for
MAC
i. If you’re running a Mac OS X version between 10.3 and 10.6, download the 32-
bit version of Python 3 for i386/PPC.
ii. If you’re running Mac OS X version 10.6 or higher, download the 64-bit/32-bit
version of Python 3 for x86-64.
2. Once the file has downloaded (it will have the filename extension.dmg),
double-click it. You’ll see the file as shown below
3. In this window, double-click Python.mpkg, and then follow the
instructions to install the software
Setting up the environment in Ubuntu
1. Python comes preinstalled on the Ubuntu Linux distribution, but it may
be an older version. Follow these steps to install Python 3 on Ubuntu 12.x:
2. Click the button for the Ubuntu Software Center in the Sidebar(it’s the
icon that looks like an orange bag—if you don’t see it, you can always
click the Dash Home icon and enter Software in the dialog).
3. Enter Python in the search box in the top-right corner of the Software
Center.
4. In the list of software presented, select the latest version of IDLE, which is
IDLE (using Python 3.2) in this example:
5. Click Install.
6. Enter your administrator password to install the software, and then click
Authenticate.
Let’s do programming in python
Let’s do programming in python
• Opening Python console !
– Once you install python, You should have an icon on your Windows or Mac OS X
desktop labeled IDLE. If you’re using Ubuntu, in the Applications menu, you
should see a new group named Programming with the application IDLE Double-
click the icon or choose the menu option, and you should see this window:
Let’s do programming in python
• This is the play ground where we give instructions to the
computer to accomplish our tasks. Sooner you will learn about
what all instructions we can give
Python Commands
• In this chapter you we will learn 3 instructions
or commands
– To print a message to computer screen
– To do arithmetic calculations
– To store values into computer memory
Print() Command
• Type below in your console and press enter
>>> print("Hello baabtra, You are awesome")
>>> print("Hello baabtra, You are awesome")
Hello baabtra, You are awesome
>>>
Print() Command
• Type below in your console and press enter
>>> print("Hello baabtra, You are awesome")
>>> print("Hello baabtra, You are awesome")
Hello baabtra, You are awesome
>>>
Congratulations! You’ve just created your first Python program.
The word print is a type of Python command called a function,
and it prints out whatever is inside the parentheses to the
screen. In essence, you have given the computer an instruction
to display the words “Hello baabtra, You are aswesome”
Try This !
• Write python command to
–Print your name
–Print Your Age
–Print your hobbies
Saving your file
1. To save a new program, open IDLE and choose File => New
Window.
2. An empty window will appear, with *Untitled* in the menu bar.
3. Enter the following code into the new shell window:
print("Hello World")
4. Now, choose File=>Save. When prompted for a filename, enter
hello.py, and save the file to your desktop.
5. Then choose Run=>RunModule.
Python Operators
Python Operators
+ Addition
- Subtraction
* Multiplication
/ Division
Python Operators
>>>8 * 3.57
Type this an press enter in your python console
>>> 17 + 365
>>>8 * 3.57
28.56
>>> 17 + 365
382
>>> 174 - 36
>>> 174 - 36
138
>>> 324 / 36
>>> 324 / 36
9
Try This !
• Write python command to find the result of
– 1340+ 1242- 43*4
–(123-12)*12+14
–12*(16/2)+13*2
Variables
Variables
• You already know that our computers are having memory to store
things !We can make use of this memory in our program to store
values using something called variables
• The word variable in programming describes a place to store
information such as numbers, text, lists of numbers and text, and
so on.
Creating a variable
• In order to create a variable named ‘studentid’ with value 100,
Type as below and press enter
>>> studentid=100
Creating a variable
• In order to create a variable named ‘studentid’ with value 100,
Type as below and press enter
>>> studentid=100
When you entered studentid=100, the computer
reserved one of the memory for us and assigned a name
‘studentid’ and stored the value 100 inside it.
How to print the value of variable
• To print the value of a variable you can simply give it inside
print() function
>>>print(studentid)
100
>>>studentName=“John”
>>>print(studentName)
John
Printing variable value inside a message
• Suppose if you want to a message as below
“Hello friends, My name is John and my Id is 100”
• It can be done as of below
>>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId))
Printing variable value inside a message
• Suppose if you want to a message as below
“Hello friends, My name is John and my Id is 100”
• It can be done as of below
>>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId))
Here %s will be substituted with
the value of variable
studentName
Printing variable value inside a message
• Suppose if you want to a message as below
“Hello friends, My name is John and my Id is 100”
• It can be done as of below
>>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId))
Here %d will be substituted with
the value of variable studentid
What is this %s and %d ?
• %s is used as a placeholder for string values you want inject into a
formatted string.
• %d is used as a placeholder for numeric or decimal values.
Type this and press enter in your python console
Now print the below message using print() function
“ Yahoo, I’ve got 45 marks out of 50 in Maths
subject !”
Try this
>>>subjectName=“Maths”
>>>totalMark=50
>>>myMark=45
Type this and press enter in your python console
Now print the below message using print() function
“ Yahoo, I’ve got 45 marks out of 50 in Maths
subject !”
Try this
>>>subjectName=“Maths”
>>>totalMark=50
>>>myMark=45 Answer
>>>print(“ Yahoo, I’ve got %d marks out of %d in %s subject !
%myMark,totalMark,subjectName)
Type this and press enter in your python console
Now calculate your percentage of mark and print the below message
“Hey, I’ve got 90 percentage of mark in Maths”
Try this
>>>subjectName=“Maths”
>>>totalMark=50
>>>myMark=45
Type this and press enter in your python console
Now calculate your percentage of mark and print the below message
“Hey, I’ve got 90 percentage of mark in Maths”
Try this
>>>subjectName=“Maths”
>>>totalMark=50
>>>myMark=45
Answer
>>>percentage=myMark/totalMark
>>>print( “Hey, I’ve got %d percentage of mark in %s”%percentage,subject”)
Exercise !
Exercise
• John has 19 apples, 21 oranges and 14 bananas to sell
• Write a python program to
• Print the total number of fruits John has?
• If he sell 12 apples, 9 oranges and 14 bananas, print how
many fruit will be left with him?
apple=19
orange=21
banana=14
totalFruits=apple+orange+banana
print(“Total Fruits = %d”% totalFruits)
apple=apple-12
orange=orange-9
banana=banana-14
totalFruits=apple+orange+banana
print(“Total Fruits after selling = %d”% totalFruits)
End of Chapter 2

More Related Content

Viewers also liked

Oops in java
Oops in javaOops in java
Session and cookies ,get and post methods
Session and cookies ,get and post methodsSession and cookies ,get and post methods
Session and cookies ,get and post methods
baabtra.com - No. 1 supplier of quality freshers
 
How To Use Autoresponders To Increase Your Sales
How To Use Autoresponders To Increase Your SalesHow To Use Autoresponders To Increase Your Sales
How To Use Autoresponders To Increase Your Sales
prosper2day2
 
SEO -- The Tortoise or the Hare
SEO -- The Tortoise or the HareSEO -- The Tortoise or the Hare
SEO -- The Tortoise or the Hare
prosper2day2
 
Memo FTT Cooperación reforzada
Memo FTT Cooperación reforzadaMemo FTT Cooperación reforzada
Memo FTT Cooperación reforzadaManfredNolte
 
Stiglitz reforming taxation_white_paper_roosevelt_institute 2
Stiglitz reforming taxation_white_paper_roosevelt_institute 2Stiglitz reforming taxation_white_paper_roosevelt_institute 2
Stiglitz reforming taxation_white_paper_roosevelt_institute 2ManfredNolte
 
Cidse statement russia_g20
Cidse statement russia_g20Cidse statement russia_g20
Cidse statement russia_g20ManfredNolte
 
Oculus rift bababte presentation
Oculus rift   bababte presentationOculus rift   bababte presentation
Oculus rift bababte presentation
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com little coder chapter - 5
Baabtra.com little coder   chapter - 5Baabtra.com little coder   chapter - 5
Baabtra.com little coder chapter - 5
baabtra.com - No. 1 supplier of quality freshers
 
Jquery
JqueryJquery
Halo
HaloHalo
How to hack or what is ethical hacking
How to hack or what is ethical hackingHow to hack or what is ethical hacking
How to hack or what is ethical hacking
baabtra.com - No. 1 supplier of quality freshers
 

Viewers also liked (18)

Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 
Oops in java
Oops in javaOops in java
Oops in java
 
Session and cookies ,get and post methods
Session and cookies ,get and post methodsSession and cookies ,get and post methods
Session and cookies ,get and post methods
 
How To Use Autoresponders To Increase Your Sales
How To Use Autoresponders To Increase Your SalesHow To Use Autoresponders To Increase Your Sales
How To Use Autoresponders To Increase Your Sales
 
SEO -- The Tortoise or the Hare
SEO -- The Tortoise or the HareSEO -- The Tortoise or the Hare
SEO -- The Tortoise or the Hare
 
Memo FTT Cooperación reforzada
Memo FTT Cooperación reforzadaMemo FTT Cooperación reforzada
Memo FTT Cooperación reforzada
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
Jvm (1)
Jvm (1)Jvm (1)
Jvm (1)
 
Stiglitz reforming taxation_white_paper_roosevelt_institute 2
Stiglitz reforming taxation_white_paper_roosevelt_institute 2Stiglitz reforming taxation_white_paper_roosevelt_institute 2
Stiglitz reforming taxation_white_paper_roosevelt_institute 2
 
Cidse statement russia_g20
Cidse statement russia_g20Cidse statement russia_g20
Cidse statement russia_g20
 
Php.ini
Php.iniPhp.ini
Php.ini
 
Oculus rift bababte presentation
Oculus rift   bababte presentationOculus rift   bababte presentation
Oculus rift bababte presentation
 
Baabtra.com little coder chapter - 5
Baabtra.com little coder   chapter - 5Baabtra.com little coder   chapter - 5
Baabtra.com little coder chapter - 5
 
Jquery
JqueryJquery
Jquery
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Halo
HaloHalo
Halo
 
How to hack or what is ethical hacking
How to hack or what is ethical hackingHow to hack or what is ethical hacking
How to hack or what is ethical hacking
 

Similar to Baabtra.com little coder chapter - 2

Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
natnaelmamuye
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonmckennadglyn
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
MarilouANDERSON
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
Nandakumar P
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
BijuAugustian
 
Module-1.pptx
Module-1.pptxModule-1.pptx
Module-1.pptx
Manohar Nelli
 
Application development with Python - Desktop application
Application development with Python - Desktop applicationApplication development with Python - Desktop application
Application development with Python - Desktop application
Bao Long Nguyen Dang
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
SHAMJITH KM
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
gmadhu8
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
Shivam Gupta
 
Python
PythonPython
Python
Shivam Gupta
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
FabMinds
 
Game programming workshop
Game programming workshopGame programming workshop
Game programming workshopnarigadu
 
3 pagesPart 1Python comes with a program called an IDLE, wh.docx
3 pagesPart 1Python comes with a program called an IDLE, wh.docx3 pagesPart 1Python comes with a program called an IDLE, wh.docx
3 pagesPart 1Python comes with a program called an IDLE, wh.docx
domenicacullison
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
Punithavel Ramani
 
slides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptxslides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptx
AkhdanMumtaz
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
shyaminfo04
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
ash52393
 

Similar to Baabtra.com little coder chapter - 2 (20)

Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
 
Module-1.pptx
Module-1.pptxModule-1.pptx
Module-1.pptx
 
Application development with Python - Desktop application
Application development with Python - Desktop applicationApplication development with Python - Desktop application
Application development with Python - Desktop application
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
 
Python basics
Python basicsPython basics
Python basics
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Python
PythonPython
Python
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
 
Game programming workshop
Game programming workshopGame programming workshop
Game programming workshop
 
3 pagesPart 1Python comes with a program called an IDLE, wh.docx
3 pagesPart 1Python comes with a program called an IDLE, wh.docx3 pagesPart 1Python comes with a program called an IDLE, wh.docx
3 pagesPart 1Python comes with a program called an IDLE, wh.docx
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
slides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptxslides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptx
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
 

More from baabtra.com - No. 1 supplier of quality freshers

Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Cell phone jammer
Cell phone jammerCell phone jammer

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Baabtra soft skills
 
Cell phone jammer
Cell phone jammerCell phone jammer
Cell phone jammer
 

Recently uploaded

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 

Recently uploaded (20)

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 

Baabtra.com little coder chapter - 2

  • 2. What you’ve learned? What is instructions? How to give instructions sequentially to accomplish a task ! What is Computer programming ? What are computer languages?
  • 4. Python – Python is a computer language which is very easy to learn and can be used to give instructions to a computer
  • 5. Setting up python environment in Windows
  • 6. 1. Goto http://www.python.org/ and download the latest Windows installer 2. for Python 3. Look for a section in the menu titled Quick Links, 3. The exact version of Python that you download is not important, as long as it starts with the number 3.
  • 7. 4. After you download the Windows installer, double-click its icon, and then follow the instructions to install Python in the default location, as follows: i. Select Install for All Users, and then click Next. ii. Leave the default directory unchanged, but note the name of the installation directory (probably C:Python31 or C:Python32). Click Next. iii. Ignore the Customize Python section of the installation, and click Next.
  • 8. • At the end of this process, you should have a Python 3 entry in your Start menu:
  • 9. Setting up the environment in MAC
  • 10. 1. Go to http://www.python.org/getit/ and download the latest installer for MAC i. If you’re running a Mac OS X version between 10.3 and 10.6, download the 32- bit version of Python 3 for i386/PPC. ii. If you’re running Mac OS X version 10.6 or higher, download the 64-bit/32-bit version of Python 3 for x86-64. 2. Once the file has downloaded (it will have the filename extension.dmg), double-click it. You’ll see the file as shown below 3. In this window, double-click Python.mpkg, and then follow the instructions to install the software
  • 11. Setting up the environment in Ubuntu
  • 12. 1. Python comes preinstalled on the Ubuntu Linux distribution, but it may be an older version. Follow these steps to install Python 3 on Ubuntu 12.x: 2. Click the button for the Ubuntu Software Center in the Sidebar(it’s the icon that looks like an orange bag—if you don’t see it, you can always click the Dash Home icon and enter Software in the dialog). 3. Enter Python in the search box in the top-right corner of the Software Center. 4. In the list of software presented, select the latest version of IDLE, which is IDLE (using Python 3.2) in this example:
  • 13. 5. Click Install. 6. Enter your administrator password to install the software, and then click Authenticate.
  • 15. Let’s do programming in python • Opening Python console ! – Once you install python, You should have an icon on your Windows or Mac OS X desktop labeled IDLE. If you’re using Ubuntu, in the Applications menu, you should see a new group named Programming with the application IDLE Double- click the icon or choose the menu option, and you should see this window:
  • 16. Let’s do programming in python • This is the play ground where we give instructions to the computer to accomplish our tasks. Sooner you will learn about what all instructions we can give
  • 18. • In this chapter you we will learn 3 instructions or commands – To print a message to computer screen – To do arithmetic calculations – To store values into computer memory
  • 19. Print() Command • Type below in your console and press enter >>> print("Hello baabtra, You are awesome") >>> print("Hello baabtra, You are awesome") Hello baabtra, You are awesome >>>
  • 20. Print() Command • Type below in your console and press enter >>> print("Hello baabtra, You are awesome") >>> print("Hello baabtra, You are awesome") Hello baabtra, You are awesome >>> Congratulations! You’ve just created your first Python program. The word print is a type of Python command called a function, and it prints out whatever is inside the parentheses to the screen. In essence, you have given the computer an instruction to display the words “Hello baabtra, You are aswesome”
  • 21. Try This ! • Write python command to –Print your name –Print Your Age –Print your hobbies
  • 22. Saving your file 1. To save a new program, open IDLE and choose File => New Window. 2. An empty window will appear, with *Untitled* in the menu bar. 3. Enter the following code into the new shell window: print("Hello World") 4. Now, choose File=>Save. When prompted for a filename, enter hello.py, and save the file to your desktop. 5. Then choose Run=>RunModule.
  • 24. Python Operators + Addition - Subtraction * Multiplication / Division
  • 25. Python Operators >>>8 * 3.57 Type this an press enter in your python console >>> 17 + 365 >>>8 * 3.57 28.56 >>> 17 + 365 382 >>> 174 - 36 >>> 174 - 36 138 >>> 324 / 36 >>> 324 / 36 9
  • 26. Try This ! • Write python command to find the result of – 1340+ 1242- 43*4 –(123-12)*12+14 –12*(16/2)+13*2
  • 28. Variables • You already know that our computers are having memory to store things !We can make use of this memory in our program to store values using something called variables • The word variable in programming describes a place to store information such as numbers, text, lists of numbers and text, and so on.
  • 29. Creating a variable • In order to create a variable named ‘studentid’ with value 100, Type as below and press enter >>> studentid=100
  • 30. Creating a variable • In order to create a variable named ‘studentid’ with value 100, Type as below and press enter >>> studentid=100 When you entered studentid=100, the computer reserved one of the memory for us and assigned a name ‘studentid’ and stored the value 100 inside it.
  • 31. How to print the value of variable • To print the value of a variable you can simply give it inside print() function >>>print(studentid) 100 >>>studentName=“John” >>>print(studentName) John
  • 32. Printing variable value inside a message • Suppose if you want to a message as below “Hello friends, My name is John and my Id is 100” • It can be done as of below >>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId))
  • 33. Printing variable value inside a message • Suppose if you want to a message as below “Hello friends, My name is John and my Id is 100” • It can be done as of below >>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId)) Here %s will be substituted with the value of variable studentName
  • 34. Printing variable value inside a message • Suppose if you want to a message as below “Hello friends, My name is John and my Id is 100” • It can be done as of below >>print(“Hello friends,My name is %s and my Id is %d”% (studentName,studentId)) Here %d will be substituted with the value of variable studentid
  • 35. What is this %s and %d ? • %s is used as a placeholder for string values you want inject into a formatted string. • %d is used as a placeholder for numeric or decimal values.
  • 36. Type this and press enter in your python console Now print the below message using print() function “ Yahoo, I’ve got 45 marks out of 50 in Maths subject !” Try this >>>subjectName=“Maths” >>>totalMark=50 >>>myMark=45
  • 37. Type this and press enter in your python console Now print the below message using print() function “ Yahoo, I’ve got 45 marks out of 50 in Maths subject !” Try this >>>subjectName=“Maths” >>>totalMark=50 >>>myMark=45 Answer >>>print(“ Yahoo, I’ve got %d marks out of %d in %s subject ! %myMark,totalMark,subjectName)
  • 38. Type this and press enter in your python console Now calculate your percentage of mark and print the below message “Hey, I’ve got 90 percentage of mark in Maths” Try this >>>subjectName=“Maths” >>>totalMark=50 >>>myMark=45
  • 39. Type this and press enter in your python console Now calculate your percentage of mark and print the below message “Hey, I’ve got 90 percentage of mark in Maths” Try this >>>subjectName=“Maths” >>>totalMark=50 >>>myMark=45 Answer >>>percentage=myMark/totalMark >>>print( “Hey, I’ve got %d percentage of mark in %s”%percentage,subject”)
  • 41. Exercise • John has 19 apples, 21 oranges and 14 bananas to sell • Write a python program to • Print the total number of fruits John has? • If he sell 12 apples, 9 oranges and 14 bananas, print how many fruit will be left with him?
  • 42. apple=19 orange=21 banana=14 totalFruits=apple+orange+banana print(“Total Fruits = %d”% totalFruits) apple=apple-12 orange=orange-9 banana=banana-14 totalFruits=apple+orange+banana print(“Total Fruits after selling = %d”% totalFruits)