This document provides an overview of Python and introduces some of its key concepts. It discusses Python's origins in the late 1980s and its increasing popularity today. The document outlines Python's main features like being easy to use, interpreted, high-level, dynamically typed, extensible, and having many available libraries. It also lists some common uses of Python like for web applications, data analytics, AI/ML, business, and more. Finally, the document introduces lessons on installing Python/PyCharm, understanding data types, working with numbers and strings, and using tuples and lists.
The document provides instructions for downloading and installing Python and PyCharm on Mac and Windows systems. It outlines the steps to download each program from their respective websites, then guides the user through installing Python and PyCharm on their device by navigating folders and clicking through installation windows. It also briefly introduces some basic programming concepts that will be covered in an upcoming Python tutorial, such as variables, data types, conditional statements, and loops.
The document provides information about a course on Object Oriented Programming concepts in Python. It outlines 6 course outcomes related to illustrating Python basics, developing scripts using control statements and data types, constructing object oriented programs using functions, and applying concepts like inheritance, polymorphism, and exception handling. It also mentions the syllabus, books and references, and provides introductory information about Python including its history, uses, installation process, interpreted nature, and basic programming concepts.
This document provides information about Python programming language and programming concepts. It discusses what a programming language is and types of programming languages like high-level and low-level languages. Python is presented as a flexible, intuitive and open source language that is good for beginners. The document outlines goals for using Python in 9th grade computer science courses, including programming fundamentals like sequencing, variables, input/output, selection, repetition and data structures. It also discusses computational thinking concepts. The rest of the document provides information on using the PyCharm IDE, creating a Python project and file, and examples of basic Python code.
This document provides an introduction to Python programming using PyCharm. It discusses downloading and installing Python and PyCharm, creating and running simple Python scripts that use print statements and variables, taking user input, and introducing conditional logic using if/else statements and while loops. Examples include printing ASCII art, basic math operations, and building a text-based choose your own adventure game. Further exercises are suggested to improve the game by adding dice rolls and more options.
This document provides an introduction and overview of the Python programming language. It describes Python as a general-purpose, object-oriented programming language with features like high-level programming capabilities, an easily understandable syntax, portability, and being easy to learn. It then discusses Python's characteristics like being an interpreted language, supporting object-oriented programming, being interactive and easy to use, having straightforward syntax, being portable, extendable, and scalable. The document also outlines some common uses of Python like for creating web and desktop applications, and provides examples of using Python's interactive and script modes.
Teaching Notes (extremely technical) detailing my Raspberry Pi program. This is for the third set of classes, where we taught the Python coding language along with logic structure. This is the first class, showing the basics of Python.
This document provides an overview of Python basics training. It covers installing Python, running Python code through various methods like the command line, IDLE, and Jupyter notebooks. It also discusses Python syntax, variables, data types, operators, conditional statements, and loops. Key Python data types include integers, floats, strings, lists, and dictionaries. The document is intended as an introduction to Python for beginners.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining functions and conditionals.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining variables, strings, lists, tuples, and dictionaries.
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.
This document provides an introduction to programming with Python. It discusses several influential early programming languages like FORTRAN, COBOL, LISP, and BASIC. It also covers key Python concepts like expressions, variables, printing output, user input, repetition with for loops and while loops, conditional execution with if/else statements, string processing, and file I/O. The document is intended to teach basic Python syntax and structures to newcomers of the language.
Computers require programming languages to communicate instructions. Python is an easy to read, powerful, and freely available programming language. It was created in the 1990s and takes its name from Monty Python. Python supports key programming concepts like variables, data types, control structures, and functions that allow it to solve a variety of problems through sequential execution of instructions.
This document provides an introduction to the Python programming language. It discusses why Python is a good choice, describes its main features like being free, easy to learn, and having a large library of tools. It also covers installing Python via Anaconda distribution, using interactive environments like Jupyter notebooks, Python syntax basics such as variables, operators, and input/output, and resources for further learning.
This document provides an introduction to basic Python programming through examples. It covers installing Python, using Python interactively for calculations, writing Python scripts, using variables, mathematical functions, user input, loops, conditional statements, tuples, and lists. The key topics are explained over 14 sections with code examples to demonstrate each concept.
This document provides an introduction to Python programming. It discusses that Python is an interpretive language and describes advantages like automatic memory management and disadvantages like slower speed compared to compiled languages. It also covers Python versions, the Anaconda IDE, variables and data types, operators, strings, lists, tuples, dictionaries, conditional statements, loops and functions like range(). Examples are provided throughout to demonstrate the core concepts of Python syntax and programming.
This document provides information about Jupyter Notebook, including:
- Jupyter Notebook is an open-source web application for creating and sharing documents containing live code, equations, visualizations, and narrative text.
- It works locally on localhost port 8888 and the easiest way to install it is through Anaconda which includes Jupyter Notebook and popular Python libraries.
- Notebooks use kernels to run code in different programming languages, with IPython being the default Python kernel.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
Python is an interpreted scripting language created in 1991 by Guido van Rossum. It is useful for small to medium sized projects and is used by many companies like Google, Yahoo, and YouTube. Python can be installed on Windows, Mac OS, and Linux operating systems by downloading the appropriate version from its website. It is an interpreted language, meaning code is executed directly without compilation. Python uses static typing where the type of a value determines how it behaves in expressions. It provides many built-in functions for common operations like math, converting between types, and rounding numbers. Functions allow code reuse and make programs more readable.
Pests of Rice: Damage, Identification, Life history, and Management.pptxArshad Shaikh
Rice pests can significantly impact crop yield and quality. Major pests include the brown plant hopper (Nilaparvata lugens), which transmits viruses like rice ragged stunt and grassy stunt; the yellow stem borer (Scirpophaga incertulas), whose larvae bore into stems causing deadhearts and whiteheads; and leaf folders (Cnaphalocrocis medinalis), which feed on leaves reducing photosynthetic area. Other pests include rice weevils (Sitophilus oryzae) and gall midges (Orseolia oryzae). Effective management strategies are crucial to minimize losses.
Ray Dalio How Countries go Broke the Big CycleDadang Solihin
A complete and practical understanding of the Big Debt Cycle. A much more practical understanding of how supply and demand really work compared to the conventional economic thinking. A complete and practical understanding of the Overall Big Cycle, which is driven by the Big Debt Cycle and the other major cycles, including the big political cycle within countries that changes political orders and the big geopolitical cycle that changes world orders.
More Related Content
Similar to introduction to python programming course (20)
This document provides an introduction and overview of the Python programming language. It describes Python as a general-purpose, object-oriented programming language with features like high-level programming capabilities, an easily understandable syntax, portability, and being easy to learn. It then discusses Python's characteristics like being an interpreted language, supporting object-oriented programming, being interactive and easy to use, having straightforward syntax, being portable, extendable, and scalable. The document also outlines some common uses of Python like for creating web and desktop applications, and provides examples of using Python's interactive and script modes.
Teaching Notes (extremely technical) detailing my Raspberry Pi program. This is for the third set of classes, where we taught the Python coding language along with logic structure. This is the first class, showing the basics of Python.
This document provides an overview of Python basics training. It covers installing Python, running Python code through various methods like the command line, IDLE, and Jupyter notebooks. It also discusses Python syntax, variables, data types, operators, conditional statements, and loops. Key Python data types include integers, floats, strings, lists, and dictionaries. The document is intended as an introduction to Python for beginners.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining functions and conditionals.
The document provides an overview of the Python programming language. It discusses that Python is an interpreted, interactive, object-oriented language created by Guido van Rossum in the late 1980s. It describes Python as high-level, portable, and has an extensive standard library. The document then covers Python variables and data types, basic operators, and provides examples of Python code, including defining variables, strings, lists, tuples, and dictionaries.
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.
This document provides an introduction to programming with Python. It discusses several influential early programming languages like FORTRAN, COBOL, LISP, and BASIC. It also covers key Python concepts like expressions, variables, printing output, user input, repetition with for loops and while loops, conditional execution with if/else statements, string processing, and file I/O. The document is intended to teach basic Python syntax and structures to newcomers of the language.
Computers require programming languages to communicate instructions. Python is an easy to read, powerful, and freely available programming language. It was created in the 1990s and takes its name from Monty Python. Python supports key programming concepts like variables, data types, control structures, and functions that allow it to solve a variety of problems through sequential execution of instructions.
This document provides an introduction to the Python programming language. It discusses why Python is a good choice, describes its main features like being free, easy to learn, and having a large library of tools. It also covers installing Python via Anaconda distribution, using interactive environments like Jupyter notebooks, Python syntax basics such as variables, operators, and input/output, and resources for further learning.
This document provides an introduction to basic Python programming through examples. It covers installing Python, using Python interactively for calculations, writing Python scripts, using variables, mathematical functions, user input, loops, conditional statements, tuples, and lists. The key topics are explained over 14 sections with code examples to demonstrate each concept.
This document provides an introduction to Python programming. It discusses that Python is an interpretive language and describes advantages like automatic memory management and disadvantages like slower speed compared to compiled languages. It also covers Python versions, the Anaconda IDE, variables and data types, operators, strings, lists, tuples, dictionaries, conditional statements, loops and functions like range(). Examples are provided throughout to demonstrate the core concepts of Python syntax and programming.
This document provides information about Jupyter Notebook, including:
- Jupyter Notebook is an open-source web application for creating and sharing documents containing live code, equations, visualizations, and narrative text.
- It works locally on localhost port 8888 and the easiest way to install it is through Anaconda which includes Jupyter Notebook and popular Python libraries.
- Notebooks use kernels to run code in different programming languages, with IPython being the default Python kernel.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
Python is an interpreted scripting language created in 1991 by Guido van Rossum. It is useful for small to medium sized projects and is used by many companies like Google, Yahoo, and YouTube. Python can be installed on Windows, Mac OS, and Linux operating systems by downloading the appropriate version from its website. It is an interpreted language, meaning code is executed directly without compilation. Python uses static typing where the type of a value determines how it behaves in expressions. It provides many built-in functions for common operations like math, converting between types, and rounding numbers. Functions allow code reuse and make programs more readable.
Pests of Rice: Damage, Identification, Life history, and Management.pptxArshad Shaikh
Rice pests can significantly impact crop yield and quality. Major pests include the brown plant hopper (Nilaparvata lugens), which transmits viruses like rice ragged stunt and grassy stunt; the yellow stem borer (Scirpophaga incertulas), whose larvae bore into stems causing deadhearts and whiteheads; and leaf folders (Cnaphalocrocis medinalis), which feed on leaves reducing photosynthetic area. Other pests include rice weevils (Sitophilus oryzae) and gall midges (Orseolia oryzae). Effective management strategies are crucial to minimize losses.
Ray Dalio How Countries go Broke the Big CycleDadang Solihin
A complete and practical understanding of the Big Debt Cycle. A much more practical understanding of how supply and demand really work compared to the conventional economic thinking. A complete and practical understanding of the Overall Big Cycle, which is driven by the Big Debt Cycle and the other major cycles, including the big political cycle within countries that changes political orders and the big geopolitical cycle that changes world orders.
How to Configure Vendor Management in Lunch App of Odoo 18Celine George
The Vendor management in the Lunch app of Odoo 18 is the central hub for managing all aspects of the restaurants or caterers that provide food for your employees.
Unit- 4 Biostatistics & Research Methodology.pdfKRUTIKA CHANNE
Blocking and confounding (when a third variable, or confounder, influences both the exposure and the outcome) system for Two-level factorials (a type of experimental design where each factor (independent variable) is investigated at only two levels, typically denoted as "high" and "low" or "+1" and "-1")
Regression modeling (statistical model that estimates the relationship between one dependent variable and one or more independent variables using a line): Hypothesis testing in Simple and Multiple regression models
Introduction to Practical components of Industrial and Clinical Trials Problems: Statistical Analysis Using Excel, SPSS, MINITAB®️, DESIGN OF EXPERIMENTS, R - Online Statistical Software to Industrial and Clinical trial approach
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...EduSkills OECD
Deborah Nusche, Senior Analyst, OECD presents at the OECD webinar 'Trends Spotting: Strategic foresight for tomorrow’s education systems' on 5 June 2025. You can check out the webinar on the website https://oecdedutoday.com/webinars/ Other speakers included: Deborah Nusche, Senior Analyst, OECD
Sophie Howe, Future Governance Adviser at the School of International Futures, first Future Generations Commissioner for Wales (2016-2023)
Davina Marie, Interdisciplinary Lead, Queens College London
Thomas Jørgensen, Director for Policy Coordination and Foresight at European University Association
How to Create Quotation Templates Sequence in Odoo 18 SalesCeline George
In this slide, we’ll discuss on how to create quotation templates sequence in Odoo 18 Sales. Odoo 18 Sales offers a variety of quotation templates that can be used to create different types of sales documents.
How to Manage Maintenance Request in Odoo 18Celine George
Efficient maintenance management is crucial for keeping equipment and work centers running smoothly in any business. Odoo 18 provides a Maintenance module that helps track, schedule, and manage maintenance requests efficiently.
Adam Grant: Transforming Work Culture Through Organizational PsychologyPrachi Shah
This presentation explores the groundbreaking work of Adam Grant, renowned organizational psychologist and bestselling author. It highlights his key theories on giving, motivation, leadership, and workplace dynamics that have revolutionized how organizations think about productivity, collaboration, and employee well-being. Ideal for students, HR professionals, and leadership enthusiasts, this deck includes insights from his major works like Give and Take, Originals, and Think Again, along with interactive elements for enhanced engagement.
Artificial intelligence Presented by JM.jmansha170
AI (Artificial Intelligence) :
"AI is the ability of machines to mimic human intelligence, such as learning, decision-making, and problem-solving."
Important Points about AI:
1. Learning – AI can learn from data (Machine Learning).
2. Automation – It helps automate repetitive tasks.
3. Decision Making – AI can analyze and make decisions faster than humans.
4. Natural Language Processing (NLP) – AI can understand and generate human language.
5. Vision & Recognition – AI can recognize images, faces, and patterns.
6. Used In – Healthcare, finance, robotics, education, and more.
Owner By:
Name : Junaid Mansha
Work : Web Developer and Graphics Designer
Contact us : +92 322 2291672
Email : [email protected]
Exploring Ocean Floor Features for Middle SchoolMarie
This 16 slide science reader is all about ocean floor features. It was made to use with middle school students.
You can download the PDF at thehomeschooldaily.com
Thanks! Marie
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecdrazelitouali
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Strengthened Senior High School - Landas Tool Kit.pptxSteffMusniQuiballo
Landas Tool Kit is a very helpful guide in guiding the Senior High School students on their SHS academic journey. It will pave the way on what curriculum exits will they choose and fit in.
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxArshad Shaikh
Diptera, commonly known as flies, is a large and diverse order of insects that includes mosquitoes, midges, gnats, and horseflies. Characterized by a single pair of wings (hindwings are modified into balancing organs called halteres), Diptera are found in almost every environment and play important roles in ecosystems as pollinators, decomposers, and food sources. Some species, however, are significant pests and disease vectors, transmitting diseases like malaria, dengue, and Zika virus.
This presentation was provided by Nicole 'Nici" Pfeiffer of the Center for Open Science (COS), during the first session of our 2025 NISO training series "Secrets to Changing Behavior in Scholarly Communications." Session One was held June 5, 2025.
Human Anatomy and Physiology II Unit 3 B pharm Sem 2
Respiratory system
Anatomy of respiratory system with special reference to anatomy
of lungs, mechanism of respiration, regulation of respiration
Lung Volumes and capacities transport of respiratory gases,
artificial respiration, and resuscitation methods
Urinary system
Anatomy of urinary tract with special reference to anatomy of
kidney and nephrons, functions of kidney and urinary tract,
physiology of urine formation, micturition reflex and role of
kidneys in acid base balance, role of RAS in kidney and
disorders of kidney
1. Introduction to Python
● Using the textbook.
● Python environment.
● Interactive Python interpreter.
● Script Python files.
● Simple Python programs.
● Variable names.
● Python is case-sensitive.
● Input from keyboard and Output to the screen.
● Errors handling.
Slides are adapted from prof Radu I Campeanu
2. How to access the textbook/Demo
1. Sign in or create an account at learn.zybooks.com
2. Enter zyBook code: ITEC1610SaedniaWinter2025
3. Subscribe
● This is a short textbook usage session
○ https://vimeo.com/285133146/48bc90afb5
● It will illustrate how to read the textbook, how to practice with the existing question and answer
examples and how to work with the labs.
● Only the first chapter of the textbook will be utilized in this lecture.
● The work in this first chapter will not be included in your assessment.
3. What is a computer?
A computer is “an electronic machine” that is designed to deal with information/data
(store data, execute instructions to retrieve the data, and process it to run a certain
application).
It has 2 main components
● Hardware: CPU, memory, keyboard, mouse, hard drive….
● Software: a set of instructions that tells the hardware what to do and how to do it (i.e.,
web browser, Microsoft Word, a game..).
4. Recap on binary system
● All information in a computer is stored and managed as binary values.
● Unlike the decimal system, which has 10 digits (0 through 9), the binary
number system has only two digits (0 and 1).
● A single binary digit is called a bit .
● On many computers, each memory location consists of eight bits, or one byte, of
information. If we need to store a value that cannot be represented in a single byte,
such as a large number, then multiple, consecutive bytes are used to store the data.
5. Downloading Python
●Python was invented by Guido van Rossum in 1991.
●For this course you need install Python as an application on your local computer. Mac and Linux operating
systems usually include Python, while Windows does not.
●You can download the latest version of Python for free from https://www.python.org on your home PC.
●Python is already installed in the DB labs.
●If you want to work with an Integrated Development Environment (IDE), I recommend to download
VSCode from https://code.visualstudio.com/download
6. Big Concept
● Programming is a recipe: understand the problem, design it, then code it!
Computers are not different to any invented appliance. They depend on these 3 steps:
● Receive an input
● Run some logical processing
● Generate some output
Inputs Outputs
Process
{…..
……
……}
Can you think of apps that do no follow that rule?
7. Computer Program Basics
A computer program consists of instructions executing one at a time. Basic instruction types are:
● Input: A program gets data, perhaps from a file, keyboard, touchscreen, network, etc.
● Process: A program performs computations on that data, such as adding two values.
● Output: A program puts that data somewhere, such as to a file, screen, or network.
Programs use variables to refer to data, like a, b, and c below. The name is due to a variable's value "varying" as a
program assigns a variable like c with new values.
a=2 ( = is the assignment operator)
b=5
c=a+b
c=2*c
print(c)
8. Python interpreter
●An interactive interpreter is a program that allows the user to execute one line of code at a time.
●In this course we shall use the black screen window created on your home PC by entering the ‘cmd’
command in the Start button window. In the DB labs the black screen window appears automatically.
●In the black screen window enter the command ‘python’. The interactive Python interpreter displays a
prompt (‘>>>’) that indicates the interpreter is ready to accept code.
●We shall not use this interactive interpreter in this course because we want to learn to write multi-line
programs, saving these programs in script files.
9. An Example with the Python interpreter
●The example shown below calculates your final mark in this course based on labs, two assignments, midterm test and final exam.
>>> labs = 80
>>> a1 = 100
>>> a2 = 90
>>> midterm = 70
>>> finalExam = 80
>>> finalMark = labs*0.2 + a1*0.1 + a2*0.1 + midterm*0.4 + finalExam*0.2
>>> print(finalMark)
79.0
Note 1: The same result can be obtained with
>>> print(80+.2+100*.1+90*.1+79*.4+80*.2)
Note 2: The operator = is not the “mathematical equal sign”. It is an
assignment operator. In the first line 80 is assigned to the variable labs.
10. Another Example
●The example program below calculates a salary based on a given hourly wage, number of hours worked
per week, and the number of weeks per year.
>>> wage = 20
>>> hours = 40
>>> weeks = 50
>>> salary = wage * hours * weeks
>>> print(salary)
40000
>>> hours = 35
>>> salary = wage * hours * weeks
>>> print(salary)
35000
11. Python interpreter inside the textbook
●The textbook for this course has its own Python interpreter.
●This interpreter will be used to build your solutions for the labs.
●When your lab solution is correct you will receive a message.
●Only correct labs should be submitted.
●If you have hard time getting a correct solution move to another lab.
12. Creating a Python script file
●You can use a text editor, such as Notepad. Write the code:
●Save the newly created file as salary.py
Interpret and run the file with the command python salary.py
The output will be:
Salary is: 40000
New salary is: 35000
wage = 20
hours = 40
weeks = 50
salary = wage * hours * weeks
print('Salary is:', salary) # this creates an output line
hours = 35
salary = wage * hours * weeks
print('New salary is:', salary)
13. Create the script file with VSCode
●Click on the VSCode icon and then click on File and click on New
●Enter the same code as in the previous slide in the right window
●Click on File and then click on Save As to baptize the file as salary.py
●Click on click on Run
●You will see the output in the small window below the code
14. General rules re Python script files
●The name of the file usually shows the purpose of the program, but there are no strict rules related to naming
the files. A good idea is to keep the names short.
●Inside the Python script files each statement must occupy a separate line.
●Almost all words in Python should be written in the lower case. The only exception is in the lecture about
classes, where the class names have to start with a capital letter.
●Empty lines are allowed.
●Comments (starting with #) are ignored by the Python interpreter.
●In lecture 4 we shall introduce code indentation, which is a very important feature of Python. Until that lecture
all lines must start in the 1st column.
15. Variable names
● In the example already discussed hours, wage, weeks are variables. They correspond to
locations of memory where the user can enter data multiple times.
● Programmers generally choose names for their variables that are meaningful. Variable
names can be as long as you like. They can contain both letters and numbers, but they
can’t begin with a number.
● It is legal to use uppercase letters, but it is conventional to use only lower case for
variables names.
● The underscore character, _, can appear in a name. It is often used in names with multiple
words, such as your_name; the alternative is to write yourName.
● If you give a variable an illegal name, you get a syntax error:
>>> 76trombones = 'big parade’
SyntaxError: invalid syntax (because of ‘76’ )
>>> more@ = 1000000
SyntaxError: invalid syntax (‘@’ is illegal)
>>> class = 'Advanced’
SyntaxError: invalid syntax (‘class’ is a reserved word)
16. Python’s “variables” are really variables
In Python you do not have to announce what kind of data you want to enter in a variable. The variable is
adjusted to the data on the right side of the assignment operator =
The following program illustrates these ideas.
a=20
a=a+50
print(a)
a="hello"
a=a+" Tom"
print(a)
Output:
70
hello Tom
The variable a starts as a location to store integers and in the second part of the program it stores text/strings.
This feature of Python will not exist in Java.
17. Python is case-sensitive
●Variables names or reserved words are case sensitive. For example the interpretation of the code:
a=2
b=5
c=A+b
prinT(c)
will signal as errors the ‘A’ in the 3rd line and ‘print’ in the 4th line
18. Text Output
●Multiple lines output:
print(‘Hello everybody’)
print(‘My name is John’)
Important note: the quote character ‘ in PowerPoint or Word is different from the Notepad character,
which Python understands. Therefore when you get Python code from this Powerpoint file you must
copy/past it into Notepad before compiling it in Python. This is the reason why in each week of the
course you will find most examples in Notepad-created text files available under the “Python code” links.
●One line output:
print(‘Hello everybody’, end=' ')
print(‘My name is John’)
19. Text and Variable Output
●One line output:
salary=1000
print(‘My salary is’, end=‘ ‘)
print(salary) # print variable value
●Or:
print(‘My salary is:’, salary)
●Multiple output lines:
print(‘1n2n3’) # n is a special character which moves the cursor to the next line
print() # this creates an empty line of output
20. Input from the keyboard
● Enter text:
print('The name of my dog is:')
dog=input()
print(dog)
Method input() always provides a text coming from the keyboard
● Enter an integer:
print('My age is:')
age = int(input()) # convert the text to integer
print(age)
● A shorter but equally correct input line is:
age = int(input('My age is:'))
print(age)
21. Errors
●Syntax errors reported by the interpreter with the line number, but the message is not always clear; often the
error can be in the previous line of code. A good idea is to check your program after a small number of lines,
in small steps.
●Runtime errors are reported when the program attempt an impossible operation. For instance in the
execution of the line of code a = int(input()) the user enters from the keyboard the word ‘Bob’.