15
Please log on Th e

Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Embed Size (px)

Citation preview

Page 1: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Please log on

The

Page 2: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

AN INTRODUCTION TO

Page 3: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages
Page 4: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

‘Python is a high-level, general purpose programming

language’

Python is one of the many programming languages

available to the public and is used daily to create

anything from games to Operating Systems.Coding language is the

foundations of anything you use on the computer – Python is but

one of them.

WHAT IS PYTHON?

Page 5: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

• Variables• Strings• Strings and Variables • Combining Numbers

and Strings

WHAT WE’RE LEARNING

Page 6: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Variable

Value

Page 7: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

red=15 blue=10 yellow=5

print(red,blue,yellow)

red=15

blue=10

yellow=blueprint(red+blue+yellow)

Page 8: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

bool=Truename=‘ ………… ’age=…………

print (name + ‘ is ’ + str(age) + ‘ years old ’)

EXERCISE

Page 9: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

StringsA string is just a combination of letters in order, e.g. “The IT Crowd”A String can be declared by either single, double or triple quoting the string – e.g. ‘The IT Crowd’ “The IT Crowd” “““The IT Crowd” ” ”

The you want to incorporate quotation marks into the string itself then you need to put a backslash before them e.g. ‘Nathaniel said \“Hello Everyone\”’

Page 10: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Combining Variables and Strings

We’re going to write a question which the user can respond to

question= “What did you have for lunch?”print(question)

answer= input() put your answer here

print(“You had ” + answer+ “ for lunch?”)

Page 11: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

question= “What\’s your name?”print(question)

answer= input()(insert name here)

print=(“ You\’re called ” + answer + “ ?”)

Page 12: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Combining Numbers and Strings

When using Python we have to tell the programme whether the value or word we’ve entered is either a string or an integerTo do this we use the commands str() and int()

We’re going to write a programme which asks the user for a question then adds 10 to that number

print(“Give me a random number”)response=input()number=int(response)plusTen=number+10print(“If we add 10 to your number we get ” + str(plusTen)

Page 13: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

I want you to write a programme which asks what you had for lunch, then the

price. The programme should then tell the user how much the meal would be with the

addition of £1.00

Challenge

Page 14: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

Recap What does each of these functions do? •print(…..)•input()•len()•str()•int()

Page 15: Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages

THANKS FOR COMING@BittTeam