0

For this code to work it has to repeat a variable amount (n) of times. It could change any time the program is run. I am extremely new to python and fairly new to programming in general, so I really don't know where to start.

def valueThree():
    name = input("What is the name?")
    valueOne = int(input("What is valueOne?"))
    valueTwo = int(input("What is valueTwo?"))
    valueThree = valueOne/valueTwo
    name_value = name, valueThree
    print(name_value)
n = int(input("How many times should valueThree() show up?"))

The program is supposed to execute valueThree n amount of times.

2 Answers 2

2

You want a for loop.

for _ in xrange(n):
    valueThree()
Sign up to request clarification or add additional context in comments.

1 Comment

For python3 this would just be range.
1

You can write

for x in xrange(n):
    valueThree()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.