I need help with my homework. Out professor doesn't explain anything and i'm struggeling.
TMy homework is:

Write, test and debug a program which asks the user to enter three floating point numbers
and then reports the largest and the smallest of these values. Here is the example program dialog:

Enter the first number: 43.5
Enter the second number: 110.2
Enter the third number 35

The smallest of the values is: 35
The largest of the values is: 110.2

When your program is working correctly, run it four times, using these value sets for the input:
20.5, 14.3, and 90.9
12.5, 25.75, and 30.8
55.7, 30.4, and 34.5
110.2, 43.5 and 35

## All 4 Replies

Please ask a specific question. Simply posting your homework requirements suggests you want someone to do the work for you.

I'm sorry, that is not what I meant to do. I just don't know where to start with this assignment. can I ask you about a different assignment that I wrote already but need tweaking a little bit?

that's what I have so far, it seems to be working. i'm not sure if it's the best way to approach this.

``````f = float(raw_input("enter the first number:  "))
s =  float(raw_input("enter the second number: "))
t =  float(raw_input("enter the third number:  "))

if f>s:

Biggest = f
if s>t:
smallest = t
else:
smallest = s
else:
biggest = t
smallest = s
else:
if s>t:
biggest = s
if f>t:
smallest = t
else:
smallest = f
else:
biggest = t
smallest = f

print
print "The smallest value is    " + str('%.2f'%smallest)

print "The biggest value is     " + str('%.2f'%biggest)
``````

Some remarks:
You do not handle incorrect input. If this is your intention, then this is ok.
The lines from 5-24 can be written:
`smallest,bigest=min((f,s,t)), max((f,s,t))`

Be a part of the DaniWeb community

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