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
User Profile
Collapse
-
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. -
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={}
No activity results to display
Show More
Leave a comment: