Introduction to Programming
Python Lab 5: Strings and Output
29 October 2019 or 14 February 2020
1
PythonLab5 lecture slides.ppt Ping Brennan (p.brennan@bbk.ac.uk)
Introduction to Programming Python Lab 5: Strings and Output - - PowerPoint PPT Presentation
Introduction to Programming Python Lab 5: Strings and Output PythonLab5 lecture slides.ppt 1 29 October 2019 or Ping Brennan (p.brennan@bbk.ac.uk) 14 February 2020 Getting Started Create a new folder in your disk space with the name
29 October 2019 or 14 February 2020
1
PythonLab5 lecture slides.ppt Ping Brennan (p.brennan@bbk.ac.uk)
2
3
4
5
string
1 2
6
Note *: Use the function input to read in the user’s first name and family name, e.g. first = input("Enter your first name: ")
7
8
9
Field width for five characters
10
LETTER_H = "* *\n* *\n*****\n* *\n* *"
print(LETTER_H) print(LETTER_E) print(LETTER_L) print(LETTER_L) print(LETTER_O)
11
12
13
14
15
a = int(input("Enter a non-negative integer: "))
16
17
18