专业英语笔记(Install and Use PyCharm)

This time we will try to write a python program: number-guessing game.

Every programmer has a story about how they learned to write their first program. I started learning as a child when my father was working for Digital Equipment Corporation, one of the pioneering companies of the modern computing era. I wrote my first program on a kit computer my dad had assembled in our basement. The computer consisted of nothing more than a bare motherboard connected to a keyboard without a case, and it had a bare cathode ray tube for a monitor. My initial program was a simple number guessing game, which looked something like this:

I'm thinking of a number! Try to guess the number I'm thinking of: 25
Too low! Guess again: 50
Too high! Guess again: 42
That's it! Would you like to play again? (yes/no) no
Thanks for playing!


There are some good IDEs for Python development, such as Geany and PyCharm.
Here we are going to use PyCharm as the IDE to write Python programs.
First download PyCharm from its official website: http://www.jetbrains.com/products.html#lang=python
专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

Click the DOWNLOAD button:

专业英语笔记(Install and Use PyCharm)

Here we choose the Community Edition and click the DOWNLOAD button:

专业英语笔记(Install and Use PyCharm)


专业英语笔记(Install and Use PyCharm)

Double click the installer file and enter the installation wizard:

专业英语笔记(Install and Use PyCharm)

Click the Next button:

专业英语笔记(Install and Use PyCharm)

Here we don't change the destination folder and use the default value.

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

Customize Pycharm as follows:

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

Create a Python package named net.hw.test in this project.

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

Now we create a new Python program named addition.py.

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)

Now we can write codes in this file.

The return value of input() function is of str type, so we have to use int() function to convert string to integer.

sum = a + b

Math English: sum equals a plus b  or  sum is equal to a plus b

Computer English: Let sum be equal to a plus b.  |  Assign a plus b to sum.

专业英语笔记(Install and Use PyCharm)

专业英语笔记(Install and Use PyCharm)