Python 3. Bool | Sololearn: Learn to code for FREE!

0

Python 3. Bool

Hello everyone! Can you help me? I have just written the programme: Hello, World = True print(Hello, World) #error Why the error?

6/25/2020 9:10:23 AM

Rich Joy

11 Answers

New Answer

+4

Unpacking is only possible if The values in LHS are equal to values on RHS Hello,World = True ,True print(Hello,World) Output : True True

+4

Rich Joy I think you want to print("Hello", "World") Hello should be "Hello" World should be "World" (notice the quotes) If you really want to assign Hello, World, both as variables equalling True, I think you need to write it like this: Hello, World = True, True also note that variables in python should not start with a capital letter. 😉 Hope that helps. Happy Coding!

+2

𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 you written on RHS a list comprehension which evolutes to list of 3 values . a,b,c = [0,1,2] since both LHS and RHS values are equal . unpacking will be done.

+2

uday kiran Type @ , a suggestion list will pop up choose a user to whom you want to mention

+1

Rich Joy Hello, World=True ,False print(Hello,World) To unpack, no. of identifiers must be equal to no. of values

+1

Thanks a lot, Uday Kiran and Kiibo Ghayal.

+1

Rich Joy Type @ , a suggestion list will pop up, choose a user to whom you want to mention

+1

uday kiran Your statement little bit confusing See this code a,b,c=[i for i in range(3)] print(a,b,c) Here's 3 identifiers in LHS & one list in RHS What will you say on this?

+1

Code Crasher 👍

0

𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 uday kiran I don't think OP understands unpacking yet, as they are just starting the python course, but cool example for others! 😎👍

0

Rich Joy In case If you want to assign the same value to more than one variable, simply use = hello = world = True