15日Python速成

为了帮助女票学习Python,特制本教程,一共分为三个部分,循序渐进。第一部分是语法,第二部分是简单小程序实战,第三部分是简单数据分析实战。

学习的目标是,15日后,可以在实际工作中用Python写一些便捷的脚本或者做些简单的数据分析。

Chapter 1:Syntax

这一章节主要两个目的,一是安装好环境,二是熟悉语法。

Day 1:初识python

Day 2:数据结构

Day 3:运算符

Day 4:跳转语句1

Day 5:跳转语句2

Day 6:函数

Day 7:模块

Chapter 2: Programming

这一部分的主要目的是将之前学习的语法利用起来,实际解决一些问题,在实战中融会贯通。

Day 8: Dice Rolling Simulator

import random

while True:
    print("Do you want to roll the dice? Y/N", end=" ")
    
    choice = input()
    
    if choice == "Y":
        dice = random.randint(1,6)
        print("Your dice is: %i" % (dice))
    elif choice == "N":
        break
    else:
        print("Input not correct, please choose again.")
        continue

print('Exit.', end=" ")

Day 9: Guess the Number

import random

while True:
  print("Do you want to play a game? Y/N", end=" ")
  choice = input()
  if choice == "Y":
    a=random.randint(1,10)    
    while True:
      print ("Please guess a number between 1 to 10")
      choice = input ()
      if choice.isdigit():
          choice = int(choice)
          if choice > a:
            print ("The number is too high")      
          elif choice < a:
            print ("The number is too low")      
          elif choice == a:
            print ("Correct!")
            break
      else:
          print("Input not correct, please guess a number.")
  else:
    print('Exit.', end=" ")
    break

Day 10: Mad Libs Generator

Day 11: TextBased Adventure Game

Day 12: Hearthstone Pack Simulator

https://knightlab.northwestern.edu/2014/06/05/five-mini-programming-projects-for-the-python-beginner

Chapter 3: Data Science

Day 13-15

https://towardsdatascience.com/exploratory-data-analysis-tutorial-in-python-15602b417445

Fork me on GitHub