I am a freshman in highschool and have just started learning Python. This week I have an assignment on while...for...and lists. I have tried this problem and this is what I got so far, I'm not sure if it is correct at all:
start=float(raw_input("Enter the starting value:"))
end=float(raw_input("Enter the ending value:"))
if start or end>0:
List=start and end
List2=List.split(" ")
for x in List2:
x=int(x)


This is the problem I need help with, thanks a lot:

Enter the starting value: 3
Enter the ending value: 8
Number Square Square root
3 9 1.73205
4 16 2
5 25 2.23607
6 36 2.44949
7 49 2.64575
8 64 2.82843

Just a word of advice about your if in your code. That is statement will almost always execute unless start is equal to zero. The reason is, even though saying OR something else. You cant apply the same operator to each. So you would have to go:

if start >0 or end > 0:
    #do stuff

Keep things simple for the first iteration of the program and use ints instead of floats for reading in the values, i.e.

start=int(raw_input("Enter the starting value:"))

Here is a hint for the next part of the program ... if you have two integers (start and end), you can get a list of all the integer values in the range between these numbers using the range() function, e.g.:

for x in range(start, end+1):
    # do something with x

Note that range(1,4) will give [1,2,3] so you need to use end+1 instead of end in the range in your program.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.