Monday, April 20, 2009

How to do for loops in Python?

Also if you can answer this question


%26quot;Using the IDLE text editor, write a program (in a file named three.py) that requests a positive integer n from the user. If the user enters a non-positive integer, your program should print %26quot;Incorrect argument%26quot;. If the entered value is positive, your program should compute the sum of all positive integers from 1 to n (including 1 and n) and then output the result in the format: %26quot;The sum is ___%26quot;. You will include the file three.py in your submission as explained below.%26quot;


please contact my by email

How to do for loops in Python?
#!/usr/bin/python


# Filename: for.py





for i in range(1, 5):


print i


else:


print %26#039;The for loop is over%26#039;





That is a for loop in Python... as for the other part to your question...





I%26#039;m not doing your work for you.



myspace quizzes

No comments:

Post a Comment