[Lecture 3] Strings and Control structures
[Lecture 3] Strings and Control structures
Strings
Lecture 3-1
Hyung-Sin Kim
• Yes, you need to be familiar with various types of data and how to
represent and handle them
• 19 vs. “19”
• radius = 3
• print(“The diameter of the circle is”, radius * 2, “m.”)
The diameter of the circle is 6 m.
• print(“Name\tNationality\nKim\tKorean\nCuller\tAmerican”)
• Name Nationality
• Kim Korean
• Culler American
• Special characters
Control Structures
– Boolean Types
Lecture 3-2
Hyung-Sin Kim
• Short-circuit evaluation
• Python draws a conclusion fast if it is obvious, without evaluating further
• >>> (2 > 3) and (5 > 7) and (5 == 5)
• >>> (3+5 == 8) or (1 / 0)
• >>> (0 > 1) and duguwe384ihoslslsjlkjsdlfijoijeroijhpojfdslkmglkl_sls930kgk
• An example
• >>> birthday = input(“Enter your birthday in the format DD MTH YYYY: ”)
• Enter your birthday in the format DD MTH YYYY: 01 Jan 2000
• >>> “Jan” in birthday True
• “in” operator
Lecture 3-2
Hyung-Sin Kim
• Nested if statements