chan 06's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Active Members
Active Posts:
63 (0.08 per day)
Joined:
07-October 12
Profile Views:
5,036
Last Active:
User is offline Sep 04 2014 12:53 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   chan 06 has not set their status

Posts I've Made

  1. In Topic: Opening a file in Python

    Posted 9 Jan 2014

    I would like to open a text document automatically

    I was thinking something like this.
    f = open("document.txt", "o")
    f.close()
    


    Any helps?
  2. In Topic: Problems with Tkinter (Scrollbar placing)

    Posted 16 Dec 2013

    I solved it, I needed to place a two frames around my listbox. My frame would use place() while my listbox need to use pack(). By creating a frame it will adjust the height on scrollbar that would accommodate the height of your widget.
  3. In Topic: How to handle button events on Tkinter

    Posted 14 Dec 2013

    Thanks for clarifying, learning slowly with tkinter barely did any gui programming before.
  4. In Topic: Problem with string formatting not showing percent sign

    Posted 1 Jul 2013

    Thank you a lot JackOfAllTrades
  5. In Topic: display month and days using for loops

    Posted 29 Jun 2013

    View Postdannii, on 28 June 2013 - 09:49 AM, said:

    I am trying to display each month of the year and the number of days for each month. My code is running 12 times and not sure how to make it run only once.

    month = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
    days_Month =[31,28,31,30,31,30,31,31,30,31,30,31]
    
    for index in range(len(month)):
        for index in range(len(days_Month)):
            print ("%s %3d" % (month[index],days_Month[index]))
        break
    
    


    Hello Dannii,

    Your program is perfectly fine, you just made a small error. You forgot to add a percent sign % at line 6:
    print ('%s %3d' % (month[index],days_Month[index]))
    


    In addition, an addition tip make sure to add brackets when you are printing because in Python 3.x, print() is no longer a statement but a function.

    Edit:
    My bad your program has run 144x, repeating twelve times. add a break to the i-loop so that the program only run 12x

    (0,0), (0,1), (0,2), (0,3),(0,4), (0,5), (0,6), (0,7), (0,8), (0, 9), (0,10), (0,11), (0,12)

    You don't want your i-loop to iterate through one more time. Or else you would get:

    (1,0), (1,1)..., (1,12)

    Meaning that your program will run one more time.

    H Hopefully that made some sense.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

chan 06 hasn't added any friends yet.

Comments

chan 06 has no profile comments yet. Why not say hello?