Python is a popular programming language used for various applications from simple tasks like plotting to complex tasks like machine learning. It has a simple syntax that makes it easy to learn. Variables in Python refer to values stored in memory and can be of different data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for objects that share variables and methods. Python uses basic syntax rules for defining variables, functions, and calling functions. It supports common data types and operators for carrying out computations. Input/output functions allow user input and printing output. Conditionals like if/else statements and loops like for and while loops allow adapting code based on conditions.
Python is a popular programming language used for various applications from simple tasks like plotting to complex tasks like machine learning. It has a simple syntax that makes it easy to learn. Variables in Python refer to values stored in memory and can be of different data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for objects that share variables and methods. Python uses basic syntax rules for defining variables, functions, and calling functions. It supports common data types and operators for carrying out computations. Input/output functions allow user input and printing output. Conditionals like if/else statements and loops like for and while loops allow adapting code based on conditions.
Python is a popular programming language used for tasks ranging from simple to complex. It has a simple syntax that makes it easy to learn. Key concepts in Python include variables, objects, classes, functions, conditionals, loops, data types, and operators. The document provides examples of basic syntax rules, defining and calling functions, if/else statements, for and while loops, and taking user input and printing output.
Python is a popular programming language that is easy to learn and can be used for tasks ranging from simple plotting to complex machine learning. Variables in Python refer to values stored in memory and can be of different data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for objects that share common attributes. Python uses basic syntax like variables assigned with "=" and functions defined with "def" to write programs. Conditionals, loops, input/output allow programs to adapt based on conditions and interact with users.
Python is a popular programming language that is easy to learn and can be used for tasks ranging from simple plotting to complex machine learning. Variables in Python refer to values stored in memory and can be of different data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for objects that share common attributes. Python uses basic syntax like variables assigned with "=" and functions defined with "def" to write programs. Conditionals, loops, input/output allow programs to adapt based on conditions and interact with users.
Introduction of python Introduction of python Introduction of pythonGandaraEyao
Python is a popular high-level programming language used for tasks ranging from simple plotting to complex machine learning. It has a simple syntax that makes it easy to learn. Variables in Python refer to values stored in memory and can take various data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for instances of objects that share variables and methods. Basic Python syntax involves defining variables and functions using keywords like def. Common data types and operators allow performing operations. Input/output functions take user input and print output. Control flow statements like if/else, for loops, and while loops change program flow.
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.
This document provides an introduction to the Python programming language. It covers Python's basic data types like integers, floats, strings and lists. It also discusses functions, conditionals, loops, modules and libraries. Example code is provided to demonstrate Python syntax for variables, arithmetic, string operations, conditionals, functions and more. Key aspects of Python like dynamic typing, indentation, comments and documentation strings are also explained.
The document provides an introduction to Python programming and application development. It discusses that Python is an interpreted, high-level and object-oriented programming language. It then covers key Python concepts like data types, variables, operators, expressions and statements. The document also lists some common Python applications like data science, web development, AI and more.
The document discusses various topics in Python programming including literal constants, numbers, strings, variables, data types, operators, and expressions. It defines literal constants as values that cannot be changed and lists examples. It describes the different number types in Python and issues with floating point numbers. It also covers formatting numbers, simple numeric operations, strings, variable naming rules, data types, assigning values, comments, and indentation in Python code.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
This document provides an overview of the Python programming language. It discusses Python's history, versions, paradigms, data types, control flow statements, functions, classes, and applications. Key points include that Python was created in the late 1980s and influenced by other languages, it supports multiple programming paradigms like object-oriented and functional programming, and it is widely used for web development, science, and data analysis.
The document provides information about the Python programming language. It discusses that Python is an interpreted, interactive, and object-oriented language well-suited for beginners. It provides details on Python's history and development as well as an overview of its core features like a broad standard library, portability, extensibility, support for databases, and an interactive mode. The document also describes how to get Python, run Python code through an interactive interpreter or script, and use integrated development environments. It covers basic programming concepts in Python like arithmetic, decision making with if/else statements, loops, lists, and functions.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
This document provides an overview of the basics of Python. It discusses code or source code, syntax, output, the console, compiling vs interpreting, the Python interpreter, expressions, operators, integer and real numbers, math commands, variables, print statements, input, the for loop, range, if/else statements, while loops, logic, and loop control statements. It also covers data types like numbers, strings, lists, sets, and dictionaries.
Python is an interpreted, general-purpose, high-level programming language. It allows programmers to define functions for reusing code and scoping variables within functions. Key concepts covered include objects, expressions, conditionals, loops, modules, files, and recursion. Functions can call other functions, allowing for modular and reusable code.
This document provides an overview of key concepts for data science in Python, including popular Python packages like NumPy and Pandas. It introduces Python basics like data types, operators, and functions. It then covers NumPy topics such as arrays, slicing, splitting and reshaping arrays. It discusses Pandas Series and DataFrame data structures. Finally, it covers operations on missing data and combining datasets using merge and join functions.
Python Programming by Dr B P Sharma for Everyoneinfo560863
This document provides an overview of Python programming. It discusses what Python is and its uses for GUI development, web development, game development, scientific development, data analytics, data science, visualization, machine learning, and IoT. The history of Python is covered, including its creation in 1991 and current version. Instructions are provided for installing and using the Anaconda IDE with Jupyter Notebook. The basics of Python programming are explained, including variables, data types, operators, conditional statements, loops, functions, and collections like tuples, lists, sets and dictionaries.
ABCs of Bookkeeping for Nonprofits TechSoup.pdfTechSoup
Accounting can be hard enough if you haven’t studied it in school. Nonprofit accounting is actually very different and more challenging still.
Need help? Join Nonprofit CPA and QuickBooks expert Gregg Bossen in this first-time webinar and learn the ABCs of keeping books for a nonprofit organization.
Key takeaways
* What accounting is and how it works
* How to read a financial statement
* What financial statements should be given to the board each month
* What three things nonprofits are required to track
What features to use in QuickBooks to track programs and grants
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptxArshad Shaikh
Wheat, sorghum, and bajra (pearl millet) are susceptible to various pests that can significantly impact crop yields. Common pests include aphids, stem borers, shoot flies, and armyworms. Aphids feed on plant sap, weakening the plants, while stem borers and shoot flies damage the stems and shoots, leading to dead hearts and reduced growth. Armyworms, on the other hand, are voracious feeders that can cause extensive defoliation and grain damage. Effective management strategies, including resistant varieties, cultural practices, and targeted pesticide applications, are essential to mitigate pest damage and ensure healthy crop production.
More Related Content
Similar to Introduction to Python Programming language (20)
Introduction of python Introduction of python Introduction of pythonGandaraEyao
Python is a popular high-level programming language used for tasks ranging from simple plotting to complex machine learning. It has a simple syntax that makes it easy to learn. Variables in Python refer to values stored in memory and can take various data types like numbers, strings, and lists. Objects are collections of data that can be manipulated using methods. Classes define blueprints for instances of objects that share variables and methods. Basic Python syntax involves defining variables and functions using keywords like def. Common data types and operators allow performing operations. Input/output functions take user input and print output. Control flow statements like if/else, for loops, and while loops change program flow.
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.
This document provides an introduction to the Python programming language. It covers Python's basic data types like integers, floats, strings and lists. It also discusses functions, conditionals, loops, modules and libraries. Example code is provided to demonstrate Python syntax for variables, arithmetic, string operations, conditionals, functions and more. Key aspects of Python like dynamic typing, indentation, comments and documentation strings are also explained.
The document provides an introduction to Python programming and application development. It discusses that Python is an interpreted, high-level and object-oriented programming language. It then covers key Python concepts like data types, variables, operators, expressions and statements. The document also lists some common Python applications like data science, web development, AI and more.
The document discusses various topics in Python programming including literal constants, numbers, strings, variables, data types, operators, and expressions. It defines literal constants as values that cannot be changed and lists examples. It describes the different number types in Python and issues with floating point numbers. It also covers formatting numbers, simple numeric operations, strings, variable naming rules, data types, assigning values, comments, and indentation in Python code.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
This document provides an overview of the Python programming language. It discusses Python's history, versions, paradigms, data types, control flow statements, functions, classes, and applications. Key points include that Python was created in the late 1980s and influenced by other languages, it supports multiple programming paradigms like object-oriented and functional programming, and it is widely used for web development, science, and data analysis.
The document provides information about the Python programming language. It discusses that Python is an interpreted, interactive, and object-oriented language well-suited for beginners. It provides details on Python's history and development as well as an overview of its core features like a broad standard library, portability, extensibility, support for databases, and an interactive mode. The document also describes how to get Python, run Python code through an interactive interpreter or script, and use integrated development environments. It covers basic programming concepts in Python like arithmetic, decision making with if/else statements, loops, lists, and functions.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
This document provides an overview of the basics of Python. It discusses code or source code, syntax, output, the console, compiling vs interpreting, the Python interpreter, expressions, operators, integer and real numbers, math commands, variables, print statements, input, the for loop, range, if/else statements, while loops, logic, and loop control statements. It also covers data types like numbers, strings, lists, sets, and dictionaries.
Python is an interpreted, general-purpose, high-level programming language. It allows programmers to define functions for reusing code and scoping variables within functions. Key concepts covered include objects, expressions, conditionals, loops, modules, files, and recursion. Functions can call other functions, allowing for modular and reusable code.
This document provides an overview of key concepts for data science in Python, including popular Python packages like NumPy and Pandas. It introduces Python basics like data types, operators, and functions. It then covers NumPy topics such as arrays, slicing, splitting and reshaping arrays. It discusses Pandas Series and DataFrame data structures. Finally, it covers operations on missing data and combining datasets using merge and join functions.
Python Programming by Dr B P Sharma for Everyoneinfo560863
This document provides an overview of Python programming. It discusses what Python is and its uses for GUI development, web development, game development, scientific development, data analytics, data science, visualization, machine learning, and IoT. The history of Python is covered, including its creation in 1991 and current version. Instructions are provided for installing and using the Anaconda IDE with Jupyter Notebook. The basics of Python programming are explained, including variables, data types, operators, conditional statements, loops, functions, and collections like tuples, lists, sets and dictionaries.
ABCs of Bookkeeping for Nonprofits TechSoup.pdfTechSoup
Accounting can be hard enough if you haven’t studied it in school. Nonprofit accounting is actually very different and more challenging still.
Need help? Join Nonprofit CPA and QuickBooks expert Gregg Bossen in this first-time webinar and learn the ABCs of keeping books for a nonprofit organization.
Key takeaways
* What accounting is and how it works
* How to read a financial statement
* What financial statements should be given to the board each month
* What three things nonprofits are required to track
What features to use in QuickBooks to track programs and grants
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptxArshad Shaikh
Wheat, sorghum, and bajra (pearl millet) are susceptible to various pests that can significantly impact crop yields. Common pests include aphids, stem borers, shoot flies, and armyworms. Aphids feed on plant sap, weakening the plants, while stem borers and shoot flies damage the stems and shoots, leading to dead hearts and reduced growth. Armyworms, on the other hand, are voracious feeders that can cause extensive defoliation and grain damage. Effective management strategies, including resistant varieties, cultural practices, and targeted pesticide applications, are essential to mitigate pest damage and ensure healthy crop production.
Analysis of Quantitative Data Parametric and non-parametric tests.pptxShrutidhara2
This presentation covers the following points--
Parametric Tests
• Testing the Significance of the Difference between Means
• Analysis of Variance (ANOVA) - One way and Two way
• Analysis of Co-variance (One-way)
Non-Parametric Tests:
• Chi-Square test
• Sign test
• Median test
• Sum of Rank test
• Mann-Whitney U-test
Moreover, it includes a comparison of parametric and non-parametric tests, a comparison of one-way ANOVA, two-way ANOVA, and one-way ANCOVA.
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
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
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptxBelicia R.S
Role play : First Aid- CPR, Recovery position and Hand hygiene.
Scene 1: Three friends are shopping in a mall
Scene 2: One of the friend becomes victim to electric shock.
Scene 3: Arrival of a first aider
Steps:
Safety First
Evaluate the victim‘s condition
Call for help
Perform CPR- Secure an open airway, Chest compression, Recuse breaths.
Put the victim in Recovery position if unconscious and breathing normally.
Completed Sunday 6/8. For Weekend 6/14 & 15th. (Fathers Day Weekend US.) These workshops are also timeless for future students TY. No admissions needed.
A 9th FREE WORKSHOP
Reiki - Yoga
“Intuition-II, The Chakras”
Your Attendance is valued.
We hit over 5k views for Spring Workshops and Updates-TY.
Thank you for attending our workshops.
If you are new, do welcome.
Grad Students: I am planning a Reiki-Yoga Master Course (As a package). I’m Fusing both together.
This will include the foundation of each practice. Our Free Workshops can be used with any Reiki Yoga training package. Traditional Reiki does host rules and ethics. Its silent and within the JP Culture/Area/Training/Word of Mouth. It allows remote healing but there’s limits As practitioners and masters, we are not allowed to share certain secrets/tools. Some content is designed only for “Masters”. Some yoga are similar like the Kriya Yoga-Church (Vowed Lessons). We will review both Reiki and Yoga (Master tools) in the Course upcoming.
S9/This Week’s Focus:
* A continuation of Intuition-2 Development. We will review the Chakra System - Our temple. A misguided, misused situation lol. This will also serve Attunement later.
Thx for tuning in. Your time investment is valued. I do select topics related to our timeline and community. For those seeking upgrades or Reiki Levels. Stay tuned for our June packages. It’s for self employed/Practitioners/Coaches…
Review & Topics:
* Reiki Is Japanese Energy Healing used Globally.
* Yoga is over 5k years old from India. It hosts many styles, teacher versions, and it’s Mainstream now vs decades ago.
* Anything of the Holistic, Wellness Department can be fused together. My origins are Alternative, Complementary Medicine. In short, I call this ND. I am also a metaphysician. I learnt during the 90s New Age Era. I forget we just hit another wavy. It’s GenZ word of Mouth, their New Age Era. WHOA, History Repeats lol. We are fusing together.
* So, most of you have experienced your Spiritual Awakening. However; The journey wont be perfect. There will be some roller coaster events. The perks are: We are in a faster Spiritual Zone than the 90s. There’s more support and information available.
(See Presentation for all sections, THX AGAIN.)
How to Manage Upselling of Subscriptions in Odoo 18Celine George
Subscriptions in Odoo 18 are designed to auto-renew indefinitely, ensuring continuous service for customers. However, businesses often need flexibility to adjust pricing or quantities based on evolving customer needs.
Himachal Pradesh’s beautiful hills have long faced a challenge: limited access to quality education and career opportunities for students in remote towns and villages. Many young people had to leave their homes in search of better learning and growth, creating a gap between talent and opportunity.
Vikas Bansal, a visionary leader, decided to change this by bringing education directly to the heart of the Himalayas. He founded the Himalayan Group of Professional Institutions, offering courses in engineering, management, pharmacy, law, and more. These institutions are more than just schools—they are centers of hope and transformation.
By introducing digital classrooms, smart labs, and practical workshops, Vikas ensures that students receive modern, high-quality education without needing to leave their hometowns. His skill development programs prepare youth for real-world careers by teaching technical and leadership skills, with strong industry partnerships and hands-on training.
Vikas also focuses on inclusivity, providing scholarships, career counseling, and support to underprivileged and first-generation learners. His quiet but impactful leadership is turning Himachal Pradesh into a knowledge hub, empowering a new generation to build a brighter future right in their own hills.
Battle of Bookworms is a literature quiz organized by Pragya, UEM Kolkata, as part of their cultural fest Ecstasia. Curated by quizmasters Drisana Bhattacharyya, Argha Saha, and Aniket Adhikari, the quiz was a dynamic mix of classical literature, modern writing, mythology, regional texts, and experimental literary forms. It began with a 20-question prelim round where ‘star questions’ played a key tie-breaking role. The top 8 teams moved into advanced rounds, where they faced audio-visual challenges, pounce/bounce formats, immunity tokens, and theme-based risk-reward questions. From Orwell and Hemingway to Tagore and Sarala Das, the quiz traversed a global and Indian literary landscape. Unique rounds explored slipstream fiction, constrained writing, adaptations, and true crime literature. It included signature IDs, character identifications, and open-pounce selections. Questions were crafted to test contextual understanding, narrative knowledge, and authorial intent, making the quiz both intellectually rewarding and culturally rich. Battle of Bookworms proved literature quizzes can be insightful, creative, and deeply enjoyable for all.
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.
Introduction to Generative AI and Copilot.pdfTechSoup
In this engaging and insightful two-part webinar series, where we will dive into the essentials of generative AI, address key AI concerns, and demonstrate how nonprofits can benefit from using Microsoft’s AI assistant, Copilot, to achieve their goals.
This event series to help nonprofits obtain Copilot skills is made possible by generous support from Microsoft.
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil DisobedienceRajdeep Bavaliya
Dive into the powerful journey from Thoreau’s 19th‑century essay to Gandhi’s mass movement, and discover how one man’s moral stand became the backbone of nonviolent resistance worldwide. Learn how conscience met strategy to spark revolutions, and why their legacy still inspires today’s social justice warriors. Uncover the evolution of civil disobedience. Don’t forget to like, share, and follow for more deep dives into the ideas that changed the world.
M.A. Sem - 2 | Presentation
Presentation Season - 2
Paper - 108: The American Literature
Submitted Date: April 2, 2025
Paper Name: The American Literature
Topic: Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
[Please copy the link and paste it into any web browser to access the content.]
Video Link: https://youtu.be/HXeq6utg7iQ
For a more in-depth discussion of this presentation, please visit the full blog post at the following link: https://rajdeepbavaliya2.blogspot.com/2025/04/thoreau-s-influence-on-gandhi-the-evolution-of-civil-disobedience.html
Please visit this blog to explore additional presentations from this season:
Hashtags:
#CivilDisobedience #ThoreauToGandhi #NonviolentResistance #Satyagraha #Transcendentalism #SocialJustice #HistoryUncovered #GandhiLegacy #ThoreauInfluence #PeacefulProtest
Keyword Tags:
civil disobedience, Thoreau, Gandhi, Satyagraha, nonviolent protest, transcendentalism, moral resistance, Gandhi Thoreau connection, social change, political philosophy
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.
2. WHAT IS PYTHON?
Python is a popular high-level programming language used in various applications.
Python is an easy language to learn because of its simple syntax.
Python can be used for simple tasks such as plotting or for more complex tasks like machine
learning.
3. VARIABLES, OBJECTS, AND CLASSES
A variable is a reference to a value stored in a computer’s memory.
Variables can be sorted into a variety of categories (or data types) such as numbers (int/float
etc), boolean values (true/false), and sequences (strings, lists etc).
An object is a collection of data from a computer’s memory that can be manipulated.
All variables are objects although some objects can be defined by data referred to
by multiple variables.
Methods are the functions used to act on/alter an object’s data. they describe what
your object can “do.”
4. VARIABLES, OBJECTS, AND CLASSES (CONT.)
A class is a collection of objects who
share the same set of variables/methods.
The definition of the class provides
a blueprint for all the objects within
it (instances).
Instances may share the same
variables (color, size, shape, etc.),
but they do not share the same
values for each variable
(blue/red/pink, small/large,
square/circular etc.)
Instance #1
Color: Pink
Name: Polo
Instance #2
Color: Red
Name: Mini
Instance #3
Color: Blue
Name: Beetle
5. BASIC SYNTAX RULES
The name of your variable (myint etc.) is placed on the left of the “=“ operator.
Most variable names are in camel case where the first word begins with a lowercase letter and any
subsequent words are capitalized.
Variable names may also appear in snake case where all words are lowercase, with underscores between
words.
The assignment operator (“=“) sets the variable name equal to the memory location where your value is found.
The value of your variable (“hello, world”) is placed on the right of the “=“ operator.
The type of this value does not need to be stated but its format must abide by a given object type (as shown).
myString = “Hello, World” myInt = 7
myFloat = 7.0
myList = [7, 8, 9] myBoolean = true
6. BASIC SYNTAX RULES (CONT.)
FUNCTION SYNTAX
def...: indicates that you are defining a new function.
function() refers to the name of your function. by convention, this name is typically lowercase and represents
a verb/action.
A,B refers to parameters (values or variables) that can be used within the statements of your function’s
definition (......). if your function has no parameters, an empty parenthetical () is used.
The return statement is an optional statement that will return a value for your function to your original call.
def function(a, b):
......
return a + b
7. BASIC SYNTAX RULES (CONT.)
CALLING A FUNCTION
Call the function by referring to its name (function()) and by placing any necessary
arguments (1, 2) within the parenthesis separated by commas. myvalue = function(1, 2)
If you wish, you can set your function call equal to a variable (myvalue). the value
returned by the function will be assigned to your variable name.
myValue = function(1, 2)
8. COMMON DATA TYPES AND OPERATORS
A data type is a means of classifying a value and determining what operations can be
performed on it. all objects have a data type.
Operators are symbols used carry out specific functions/computations.
https://www.youtube.com/watch?v=v5mr5jnkczi
9. INPUT/OUTPUT
Input functions (input()) allow users of a program to place values into programming code.
The parameter for an input function is called a prompt. this is a string (this can be indicated by “” or ‘’)
such as “enter a number: “
The user’s response to the prompt will be returned to the input statement call as a string. to use this
value as any other data type, it must be converted with another function (int()).
Print functions (print()) allow programs to output strings to users on a given interface.
The parameter of this function is of any type. all types will automatically be converted to strings.
xString = input(“Enter a number: “)
x = int(xString)
y=x+2
print(y)
10. IF-ELSE STATEMENTS
If-else statements allow programmers to adapt the function of their code
based on a given condition.
If a given condition (i.e. x % 2 == 0) is true, then the statements following
the if statement (if) will be executed. if the condition is false, the statements
following the else statement (else) will be executed.
The condition is tested using the boolean operators == (is equal to), !
= (is not equal to), and (used to test multiple conditions), and or
(used to test if at least one condition is true).
Additionally, else-if statements (elif) can be used to provide unique
coding statements for multiple conditions.
xString = input(“Enter a number: “)
x = int(xString)
if x % 2 == 0:
print(“This is an even number”)
elif x == 0:
print(“This number equals 0”)
else:
print(“This is an odd number”)
11. FOR LOOPS
For loops perform the same task (iterate) for the number of
times specified by an iterable (something that can be evaluated
repeatedly such as a list, string, or range).
For defines the for loop
X is the variable defining the number of times the statements
within the loop (print(myint)) are executed.
The range(start, stop, step) function is often used to define x.
The starting value is defined by start, the final value is
defined by stop – 1, and the magnitude at which x
changes between loops is defined by step.
In is a boolean operator that returns true if the given value (x) is
found within a given list, string, range etc.
myString = input(“Enter a number: “)
myInt = int(myString)
for x in range(0, 5, 1): print(myInt)
12. WHILE LOOPS
● While loops are statements that iterate so long as a given
boolean condition is met.
○ x (the variable determining whether or not the
condition is met) is defined and manipulated outside
of the header of the while loop (while)
○ The condition (x < 5) is a statement containing a
boolean variable.
○ Break is a statement used to exit the current for/while
loop.
○ Continue is a statement used to reject all statements in
the current for/while loop iteration and return to the
beginning of the loop.
myString = input(“Enter a number: “)
myInt = int(myString)
x = 0
while x < 5:
print(myInt)
x= x +1