Reputation: 33
I want to ask the following questions:
What is the team name?
How many points did (team_name) score?
I've tried the this and have gotten back an error:
team_name = input("What is the team name? ")
points = input("How many points did", team_name, "score? ")
please help!
Upvotes: 2
Views: 23559
Reputation: 11
for a in range(1,1000):
for b in range(1,1000):
for c in range(1,1000):
if b>a and c and c>b:
if c**2==b**2+a**2:
print((a,b,c))
Output:
(3, 4, 5)
(5, 12, 13)
(6, 8, 10)
(7, 24, 25)
(8, 15, 17)
(9, 12, 15)
(9, 40, 41)
(10, 24, 26)
(11, 60, 61)
(12, 16, 20)
(12, 35, 37)
(13, 84, 85)
(14, 48, 50)
(15, 20, 25)
(15, 36, 39)
(15, 112, 113)
... (goes on)
Upvotes: 0
Reputation: 34
team_name = input("What is the team name:")
points = "How many points did %s score" #%s is the variable
points_print = input(points % (team_name))
This is an easy way to fix your problem, use '%s' to call your variable, it will look better when printed.
Upvotes: 1
Reputation: 33984
Here's a python3.6 way of doing this:
points = input(f"How many points did {team_name} score?")
Upvotes: 5
Reputation: 289
What error are you getting?
I'm fairly confident your problem is that you are passing three parameters to input on the second line, instead of concatenating the strings which I think you're trying to do here.
Try:
points = input("How many points did " + str(team_name) + " score?")
Upvotes: 3