+ 2

And & or?

I don't understand the, I already lost 4 hearts doing the lessons and then 1 heart trying to skip it! Can someone tell me what the and & or think means with the "trues" and the "falses" I lost to many hearts today please help! Also whats the boolean thing?

16th Dec 2024, 2:58 AM
print ("python")
print ("python") - avatar
5 ответов
+ 6
print ("JUMP_LINK__&&__python__&&__JUMP_LINK") the "true" and "false", also known as booleans, in a lesson, Sololearn has given an example for better understanding it, imagine a switch, "true" and "false" are "on" and "off", now if the switch control the led, when the switch = True, means led is on and the led is now lighting, but if it's = False, means off, then the light stop lighting Also there're "or" and "and", it's very useful when using it with booleans, but it's may a bit tricky for new learners, mostly, when the switch is on (true) and the light is on (true), True and True returns True, but if switch is on (True) and light is off (False), True and False returns False, so you now need to replace a new led :> Here's a list of "and": True and True = True True and False = False False and False = False True and True and False = False So only when True == True, then the result is True, for "or", it's opposite of "and", means: True or True = True True or False = True False or False = False True or False or False = True Tricky right?
17th Dec 2024, 11:49 AM
Ikuyo Kita ☕︎︎
Ikuyo Kita ☕︎︎ - avatar
+ 8
print ("JUMP_LINK__&&__python__&&__JUMP_LINK") , if you get stuck with this topic, you should re-start the related lessons from the tutorials `introduction to python` or `python developer`. there are also 2 tutorials from the community section that may help: https://www.sololearn.com/learn/o-Python/2279/?ref=app https://www.sololearn.com/learn/o-Python/2276/?ref=app > you should keep going on, give it a try, because understanding this is of fundamental importance for further learning and to understand coding. so please be patient!
16th Dec 2024, 12:13 PM
Lothar
Lothar - avatar
+ 6
They are ways to test multiple conditions. Say you're playing a computer game and you need to collect 100 coins to pass the level when you get to the end of the level. If you get to the end of the level but don't have 100 coins, you have to go back through the level to find more coins, right? That could be written something like this: if (coins >= 100) and (end_level == true): next_level() In the same game, the player wants to progress past some puzzle. This puzzle is solved in 2 ways, with a key OR with a correct combination. They don't need both to solve, just one - this is different from the end level above. That could be written something like this: if (player_has_key == true) or (puzzle_combination == true) puzzle_open() Does that help a bit?
16th Dec 2024, 6:41 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Share the question.
16th Dec 2024, 3:16 AM
Jerry Hobby
Jerry Hobby - avatar
0
Ikuyo Kita, thank you for the information now i can understand it more. the only difference i see is "true and false" or "true or false" its the only one that haves a different output. so correct me if this is wrong: "and" is like the second word after the word "and" is the output. the "or" is like the first word instead of the last word is the output. is that right???
18th Dec 2024, 1:24 AM
print ("python")
print ("python") - avatar