Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Arbitrarily enter a month value represented by an integer from the keyboard, and program and output the English representation of the month with a pointer array. If the entered month value is not with
Arbitrarily enter a month value represented by an integer from the keyboard, and program and output the English representation of the month with a pointer array. If the entered month value is not with
Arbitrarily enter a month value represented by an integer from the keyboard, and program and output the English representation of the month with a pointer array. If the entered month value is not within the range of 1~ 12, 1. Double-click to open the pycharm tool in python language and create a new python file month.py.

2. Define a variable month in the month.py file and call the int () and input () methods.

3. Then use the if...elif statement to judge and print the corresponding month according to the value of each month.

4. Save the file and run it. You can see that you need to enter a numerical value. Enter 6 to print out June.

5. What happens if the input value exceeds 1 to 12?

6. In order to prompt the user to be friendly, you need to add an else statement at the end.