Need Help with Two Simple Calculating Programs

This is the place for queries that don't fit in any of the other categories.

Need Help with Two Simple Calculating Programs

Postby IllusionaryRooster » Fri Oct 04, 2013 12:52 am

Hey, I'm new to this and taking a class in college. I'm really struggling with what seems should be some of the most basic things. The problems I need help with are:

1)A program that calculates and prints the product of two even integers between one to 1000 (I'm not sure why it has to be to 1000).
It should look like:
Code: Select all
The product of even integers from 1 to 7 is: 48


2)Build a small calculator by taking three inputs. Two of which are integer or floats and the third is an input of +,-,/,*. It should then print out a result.

Obviously I don't want the straight out answers, but I barely have an idea where to start. I've tried using while loops and range functions for the first problem but have been unable to organize them in a way to get the results I need.
Thanks all in advance for the help! :D
I hope this will be the first post of many on this forum and that at some point I will be answering questions like this for people in my position.
-Russ
IllusionaryRooster
 
Posts: 1
Joined: Fri Oct 04, 2013 12:36 am

Re: Need Help with Two Simple Calculating Programs

Postby hansn » Fri Oct 04, 2013 8:44 am

It would be nice if you could show us some efforts you have made, so that we know what parts you understand and what you don't.
That way it's much easier to point you in the right direction in stead of handing you an answer.

You're right to use a loop in the first exercice. Try incrementing a variable on each iteration of the loop and finally returning that variable.
The seconds exercise would contain some if and elif statements to check which operator(+,-,/,*) is passed to the function.
hansn
 
Posts: 87
Joined: Thu Feb 21, 2013 8:46 pm

Re: Need Help with Two Simple Calculating Programs

Postby Kebap » Fri Oct 04, 2013 9:51 am

IllusionaryRooster wrote:I hope this will be the first post of many on this forum and that at some point I will be answering questions like this for people in my position.

This is a noble goal and I hope I don't sound too demotivating when I now ask you to please read the thread for new users. ;)
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 390
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe


Return to General Coding Help

Who is online

Users browsing this forum: W3C [Linkcheck] and 3 guests