To solve a problem in Pythonic way

Hi today I have tried to solve one of the problem given by friend in python. The question of him was . Once a grandma who sells eggs get accident and all the eggs on his bag was broken . And because of it  she have to give count of all the broken eggs to his owner. But she doesnt know how the total count of eggs , she only remembers that while keeping the eggs in 1 number the remainder egg would be 1 , Similarly for 2,3,4,5,6 all the remainder would be 1. And while keeping 7 at a time the remainder would be 0. Now how we can find the total number of eggs in a python program is just simple as this.

while 1:
for i in range(1, 1000):
if (i%2) == 1 and (i%3) == 1 and (i%4) == 1 and (i%5) == 1 and (i%6 == 1) and (i%7 == 0):
print i
break

Infinite Loop and Break in python

>>> while 1:
...     name = raw_input( 'Enter a name: ')
...     if name == 'quit' : break
...
Enter a name: joe
Enter a name: jack
Enter a name: jest
Enter a name: kare
Enter a name: quit
>>>
KeyboardInterrupt
>>>

To Get Both the variable and value from Dictionary in Python

Hi Everyone,

Today I have tried something with dictionary to get the variables and values . Have a check of how I have done this.

>>> studentnames={'micheal' : 21, 'Ashok' : 22, 'Praveen' : 23, 'Rajesh' : 17}
>>> for items in studentnames:
...     print items
...
Praveen
Ashok
micheal
Rajesh
>>> for items in studentnames:
...     print items, studentnames[items]
...
Praveen 23
Ashok 22
micheal 21
Rajesh 17
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>

How To Find the System Path

Here is a simple program to check the system path using python interpreter :

import os
os.environ["PATH"].split(""")

To clear the Screen of Python Cmd Prompt

To Clear the screen of python cmd promt in Linux use CTRL + L