+ 1

I have this program and it’s telling me theres a problem with the last s1

if h > 10: h1 = str(h) else: h1 = "0" + str(h) if m > 10: m1 = str(m) else: m1 = "0" + str(m) if s > 10: s1 = str(s) else: s1 = "0" + str(s) print (h1 , ":" , m1 , ":" s1)

1st Mar 2018, 3:22 PM
Camila Lancheros
Camila Lancheros - avatar
8 odpowiedzi
+ 1
I don't use Python but I tested your code and there is a syntax error due to the comma like I mentioned. Try putting a comma after the last double quote just before 's1' and see if that fixes it. Otherwise just check your source code for any other characters that shouldn't be there. Like so.. print(h1, ":", m1, ":", s1)
1st Mar 2018, 4:49 PM
Lewis
Lewis - avatar
+ 1
Please specify the language !
1st Mar 2018, 3:31 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 1
First off I don't know what language you're using as you didn't specify and I don't know where the variables you're using came from since. If you could provide more detailed information I may be able to help more. Although I noticed there isn't a comma in the last part of your print statement. It seems to have broken a common trend, could that be it?
1st Mar 2018, 3:43 PM
Lewis
Lewis - avatar
+ 1
Thank you very much!!!
1st Mar 2018, 5:06 PM
Camila Lancheros
Camila Lancheros - avatar
0
I'm using Python
1st Mar 2018, 3:58 PM
Camila Lancheros
Camila Lancheros - avatar
0
I already tried the comma and it dodn't work
1st Mar 2018, 4:02 PM
Camila Lancheros
Camila Lancheros - avatar
0
Could you please provide the error message you're getting about the 's1' variable?
1st Mar 2018, 4:18 PM
Lewis
Lewis - avatar
0
SyntaxError: invalid sintax
1st Mar 2018, 4:38 PM
Camila Lancheros
Camila Lancheros - avatar