I learned Python with a beautiful girl at Paiza # 02
I can do her with Python and Paiza's Learn beautiful girl and Python service So it's a miscellaneous impression. This article is introductory part 2. Please see here for 1.
Introductory 2 (about 60 minutes)
chapter1: Conditional branching by IF statement (4:44)
- About IF statement
- Change the display depending on the numerical condition
if condition:
Action when the conditions are met
else:
Action when the condition is not met
- 4 spaces for indentation
- == Equal condition
Note that it is easy to forget * **: **
- Indentation is also important so don't forget
- The concept of blocks, blocks with the same indentation range
Exercises
- 4 questions
- How to use if, else
- Easy to make mistakes
chapter2: Let's combine multiple conditions (3:46)
- Elif can specify other conditions
if condition 1:
action1
elif condition 2:
action2
else:
action3
Exercises
- 2 questions
- Syntax errors and elif
chapter3: Let's conditional branch with comparison operator (4:54)
And <appear as operators other than * ==
- More than or equal to ``
> maintained
and ``` <reduced`
- `` `!
Exercises
- 3 questions
- Increase the difficulty a little and write the conditional expression yourself
- The problem of pointing out logic mistakes instead of syntax mistakes
chapter4: Let's make a fortune (5:04)
- Summary per if else elif
- Is it working as expected? Run the randint result while printing and debugging.
Exercises
- 1 question
- May not be much different from chapter 3
chapter5: Reproduce the critical hit of RPG (2:46)
- A story about trying to do something a little more complicated with the blocks in the if statement
Exercises
chapter6: Let's find the year of Heisei from the Christian era (4:19)
- if is over
- AD-The story to be processed in 1988
- I got `` `datetime.date.today (). Year``` for this year's acquisition
Exercises
Rough impression
This concludes the currently published introduction to Python. As expected, the level is higher than introductory 1, but it still feels like a rudimentary beginning. It feels like a polite explanation of "professional" as "Python as a programming language". However, as the syntax is only if, I thought it would be nice if for / while came out at least.