0

nums = [1, 2, 3,5] nums(1)=nums(2)-0 if 2 in nums: nums.append 8 print(nums) else: nums.append(5) print(nums) print(nums)

Can anybody fix the error and write the correct code?

15th May 2017, 2:50 AM
chittabrata
chittabrata - avatar
4 ответов
+ 2
Python requires indentation to indicate the end of blocks of code, such as what is in your else clause and what is after. So what you need are tabs on the lines within the if and else sections. That should get you on the move!
15th May 2017, 3:01 AM
Jim
Jim - avatar
+ 2
Still an indentation error? That formatting looks about right... If so, try spaces instead of the tabs, perhaps.
15th May 2017, 12:53 PM
Jim
Jim - avatar
+ 1
nums = [1, 2, 3,5] nums(1)=nums(2)-0 if 2 in nums: nums.append 8 print(nums) else: nums.append(5) print(nums)
15th May 2017, 4:53 AM
Mayur Chaudhari
Mayur Chaudhari - avatar
0
This shows error
15th May 2017, 5:08 AM
chittabrata
chittabrata - avatar