Python

Python 할 일 추천기

ksg97031 2014. 9. 14. 22:44


what_is_the_best_i_can_do_now.py

2차원 배열은 [ []*5 for x in range(0,5) ] 이런식으로 만들어 주면된다. ( [5][5] ) 

크기를 동적으로 잡는 방법은 아직 모르겠다.

random 함수는 random 모듈을 import 하고  num=random.randrange(0,5) 이런식으로 해주게 되면 0에서 5-1까지에 랜덤한 숫자가 나온다.

for i in range(10):

print (random.randrange(0,10000))

898

5574

1849

881

7853

7518

8494

9265

9799

5460 

 

import os

import random

downclear = lambda: [ print("\n") for x in range(100)]

upclear = lambda: [ print("\n") for x in range(10)]

def what_is_the_best_i_can_do_now():

    n=5

    i_should_do_list=[ []*n for x in range(0,n) ]

    print("Enter the \"What is the Problem that you should do\" ")

    print("If you want to stop, enter the \"stop\"")

    count=0

    while 1:

        i_should_do_list[count]=input("What Should you do Now???\nI have to do this : ")


        if i_should_do_list[count] == "stop" or count==n-1:

            break

        

        count+=1

    

    [ print("GOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOG\

GOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOG\

GOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOGGOGOGOGOGOGOGOGOG") for x in range(0,10) ]

    downclear()


    go_random(i_should_do_list)



        

def go_random(i_should_do_list):

    num=random.randrange(0,5)

    [ print("You have to this first! : %s" % i_should_do_list[num]) for x in range(0,10)]

    upclear()

        

        

      

    


if __name__=="__main__":

    what_is_the_best_i_can_do_now()