I'm not sure what you're asking. Are you asking if it's possible to have a for loop within a for loop? Sure, it is.
Or are you asking if you can iterate over two objects at once, then the answer is sure, but perhaps not in the way you might think. You use tuple unpacking to assign multiple objects at once.
>>> for x,y in zip(xrange(5),xrange(1,6)):
... print x, y
>>> for x,y in zip('ABC','BCD'):
... print x, y
This can be applied to anything zip'able.
If you're not asking either of those, then I'm not sure what you're asking.
Lets take an example of lines containing in a file.
"This is the third largest lake in the world. This is the third largest beach in this country...........................................
He won third prize in quiz"
So if i set the condition as the word "third" it will take 1st line and print it. So while going inside the file to take other information like winning the prize it should not consider the word "third" in 1st line which tells about lakes and beaches.
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"