I am having a little bit of trouble with loops.

mainTest = "Menu:\n(R)enter Numbers\n(O)dd or Even\n(S)um and Average\n(Q)uit\nWhat would you like to do?: "

getInteger1 = input("Your first number?: ")
getInteger2 = input("Your second number?: ")

print mainTest
while userInput != '':
    if userInput == 'r' or 'R':
#This is where I am having trouble, when the menu is displayed the user has the option of re-entering the previous numbers.

If the user inputs 'r' or 'R' I want the 'getIntergers1 and 2' to be displayed again.
I have done google searches but with no result.
Can anyone please lend me a hand or point me in the right direction?

They where just set at line 3 and 4 and displayed. What is your logic? Those lines look to be wrong place for me as you are inputing them before the menu. Could you present your plan (pseudo code) for the program. If you want to show drawn plan, it is possible to attach file from Advanced view.

First number:
Larger, second Number:

Menu:
(R)e enter numbers
(O)dd or even
(S)um and Average
(Q)uit
R

Enter first number:
Enter larger, second number:
(if errors repeat questions with comment)

Menu:
(R)e enter numbers
(O)dd or even
(S)um and Average
(Q)uit

O
Odd or even:
if odd display odd numbers in range
if even display even numbers in range

Menu:
(R)e enter numbers
(O)dd or even
(S)um and Average
(Q)uit

S
Display sum of the two numbers
and display the average

Menu:
(R)e enter numbers
(O)dd or even
(S)um and Average
(Q)uit
Q
Farewell message here

Have to forgive it, it was done up quite quickly earlier today.

I want to give the user options to re-enter the numbers after they already have, if that makes sense, if they decided they want to change them.

Try

if userInput in ['r', 'R']:
# ----- or -----
if userInput.lower() == "r":

I solved my problem by importing another set of code (it was a group task so we decided it would be easier to simply import other snippets of code to the main code.)

In case any beginners run into a similar problem, here's the error checker and also how to repeat a function if there was an invalid input.

def variable():
        global var
        var = input("text: ")
        while var <= 0:
            print "invalid."
            var = input("previous text: ")
        return var

def var2():
        var2 = input("more text: ")
        while var2 <= var1t:
            print "invalid"
            secondInt = input("more text: ")
        return var2

Just put prompt text and range as parameter, do not repeat almost identical code. Global is unnecessary and ugly, as it is return value. Variable secondInt is never used.

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.