User Profile

Collapse

Profile Sidebar

Collapse
nana pink
nana pink
Last Activity: Apr 1 '11, 08:16 PM
Joined: Mar 21 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • nana pink
    replied to How to construct this function
    Thank you bvdet for your solution, you are almost there.
    But, how can we return the original value which are -7?

    >>> maxSquare([5, ‐7, 3])
    -7
    See more | Go to post

    Leave a comment:


  • nana pink
    started a topic How to construct this function

    How to construct this function

    I am trying to construct a function called maxSquare. In which it takes a list of integers X and returns Xi with the maximum square value, without using loops.

    Sample Input/Output

    >>> maxSquare([5, ‐7, 3])
    -7


    If you coul help me with this, I would appreciate it.

    Thanks in advance.
    See more | Go to post

  • nana pink
    started a topic How to handle or skip end‐of‐line characters

    How to handle or skip end‐of‐line characters

    I am trying to read from a txt file and counts the number of times each word appears. The problem is that it counts the EOL characters as well. I want to skip them. I tried to use the rstrip, still it didn't do anything. So how can I handle these end-of-line characters?

    I am using python 3.

    Please help.

    Code:
     
    Object= open('w.txt','r')
    L= Object.read().rstrip()
    
    occurrenences={}
    ...
    See more | Go to post
No activity results to display
Show More
Working...