L1 Python - Input and Output Flashcards

1
Q

What is Python?

A
  • Python is a high-level programming language – that means programmers can write programs that look a lot like English making it much easier to work with
  • Python is a very popular programming language and is used by thousands of companies including:
    • NASA
    • Google’s Search Engine
    • CERN Large Hadron Collider Research
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the PRIMM Model?

A

PREDICT – when you find a new piece of code PREDICT what you think it will do

RUN – RUN the code to see if your prediction was correct/ If not, why do you think that was?

INVESTIGATE – INVESTIGATE and experiment, with your code, change things and see what happens

MODIFY – Now you can MODIFY the code to make it behave in different ways

MAKE – A final challenge where you MAKE your own program that uses the ideas you have learned

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Thonny and what does it allow you to do?

A
  • Thonny allows you to write, run and debug your program in one place.
  • Thonny is free to download and install so can be used at home.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give an examples of input and output:

A
  • name = input(“What is your name?”)
  • print (“Hello’”+ name)
  • colour = input (“what is your favourite colour?”)
  • print (“Cool, I like “ + colour + “ too!”)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is concatenation and give examples:

A
  • print(“Cool, I like ” + colour + “ too!”)
  • Data enclosed in speech marks are strings – this means they are alphanumeric characters
  • The plus + sign glues strings together – this is called concatenation
  • We have to remember to put the spaces into the sentence around the variable this is useful if we want to add punctuation to the end of a sentence.
  • print (“Hello ” + name + “!”)
  • We can also use commas to put the spaces around variables for us.
  • print(“Cool, I like ” , colour , “ too!”)
  • name = input(‘What is your name?)
  • green = a string,a sentence, or letters which will get printed out on the screen
  • purple = functions e.g. print
  • black = variables, in between the pluses or commas
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give functions:

A
  • .upper() = makes things upper case

- .title() = puts things in title format

How well did you know this?
1
Not at all
2
3
4
5
Perfectly