+ 2
Solved Chess tournament you’re creating code for a chess tournament
# Convert the values into numbers wins = input() ties = input() # 1 win = 3 points # 1 tie = 1 point # Calculate the score score = int(3*wins+ int ties) # Concatenate the 2 strings to produce a message message = "Score: "+ str(score) # Display the message print(message)
17 Respuestas
+ 4
Christian Francis did you use int(wins) and int(ties)
In the above code example you didn't
this converts a string to an integer
score = int(wins)*3 + int(ties)*1
+ 4
I did it
+ 4
# Convert the values into numbers
wins = input()
ties = input()
# 1 win = 3 points
# 1 tie = 1 point
# Calculate the scor
score = int(wins)*3 + int(ties)*1
# Concatenate the 2 strings to produce a message
message = "Score: " +str(score)
# Display the message
print (message)
+ 3
Line 1: "Convert the values into numbers".
State clearly what issue you encounter.
+ 3
Im not guessing
+ 2
Suppose the team has 4 wins and 1 draw. What score should the program output? What score do you observe it to output?
Stating what issues you encounter means describing what happens when you run the program: What is the desired output? What is the actual output? What is the error message that the program displays?
+ 2
Convert the values that are stored in the variables wins and ties to numbers. Using the int() function.
You can show us your updated code then.
+ 2
Because i forgot to put int because its an integer?
+ 1
I did
+ 1
Um that is what the ai said
+ 1
Great!
Now try to explain why this works, while the other one doesn't.
+ 1
What data type were "wins" and "ties" before you applied the int() function?
What does "integer" mean in common speech?
+ 1
Lisa i did it okay
+ 1
the task is about understanding what you did.
happy coding!
+ 1
You too reply to my comments
+ 1
Christian Francis ℹ️ just a reminder to convert input values before doing any calculations on them.
0
Read the advice carefully, step by step. Don't guess.