#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Couple of assignments / help me


    Dear Python developers ,

    I am a newbie in python and still learning the basics but I need your help in these urgent couple of questions ,,, please be kind and help me with below ... All my appreciation to u

    1- Write a software application , where the input is the time and the output is the degree between the minutes and hours hands.
    the input will be in this format : "hh:mm" . Eg: "12:00" returns 0 degree.

    2- Let's say you have a file which contains numeric values such (4393, 437834, 555232, 534344, etc....)
    You need to write a software that reads the file input, and then takes user input and returns back "sibling values", sibling values are the entries in the file which are consisted from the input numeric. For example, if the file contains (1123,1231,312,...etc), and the user searched for 3211 the results will be 1123 and 1231. Your code Mustn't do full scan or permutation(i.e if the search input is 123,it's not allowed to search for 123,132,213,231,312,321 --all possibilities)

    Please note that Programming Language should be python
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    138
    Rep Power
    2
    What have you got so far?
    http://www.catb.org/esr/faqs/smart-questions.html#code
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    Thank you for ur reply

    Regarding the first one I have reached the formula that is inside the function :

    h_digree = ( h *60 + m / 60 ) * 360 / 12

    m_digree = ( h *60 + m ) ;

    answer = h_digree - m_digree

    is this correct ? and what about the second one I don't really get it
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    138
    Rep Power
    2
    Doesn't seem to be correct, no. Did you run the code yourself?

    Code:
    Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> h = 12
    >>> m = 0
    >>> h_digree = ( h *60 + m / 60 ) * 360 / 12 
    >>> print h_digree
    21600
    >>> m_digree = ( h *60 + m )
    >>> print h_digree - m_digree    # should be 0
    20880
    http://www.catb.org/esr/faqs/smart-questions.html#code
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    138
    Rep Power
    2
    Originally Posted by 101newbie
    and what about the second one I don't really get it
    Well, if you don't understand the assignment, I suggest you ask your professor/teacher/mentor for clarification.
    http://www.catb.org/esr/faqs/smart-questions.html#code
  10. #6
  11. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    Have you ever seen an analog clock?

    m_digree = ( h *60 + m ) ;

    The angle of the minute hand is independent of hours.


    I have no idea what is a "sibling value" from that description and a barking dog.
    Last edited by b49P23TIvg; April 17th, 2013 at 07:23 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo