print ("Enter a num. ") num = int (input()) if bool: print("Thank") else: print("no num was enter") print("done") if i type 0 here it retunrs True how come?
print("Enter a num.") num = int(input()) if bool(num): # This will be True if num is not 0 print("Thank") else: print("no num was entered") print("done")
Using if bool(num): checks if num is a non-zero value, allowing the program to respond accordingly. If num is 0, it evaluates to False, triggering the else block. In contrast, if bool(): without any arguments always returns False, making it ineffective for checking conditions. Thus, you should use if bool(num): to evaluate the specific input from the user.
We miss your videos dear - Please come back 🎉😊and teach us more about coding, LLM’s Ai, AGi and sharing your perspectives on the future of coding would be greatly appreciated❤ 🙏🏾 🎉
OMG, this course is exactly for me and I am finding this 8 years after this is uploaded, I just want to learn coding to automate stuff without trying to learn every technical thing in it.
Yes. The first 15 videos here on RU-vid cover the Python language which hasn't changed. All the info still works. The last half of the course on Udemy also still works, though you have to be careful to install the exact versions of the third party modules.
Hi Sweigart , could you pls explain this i found bug on your code. How many cats do you have? four You did not enter a number. two Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> two NameError: name 'two' is not defined
I'd really like to know what program is being run at 8:23 to break down functional priority. I know this video is 8 years old but "Alms for the noobs" would be appreciated. It seems invaluable to me. Either way, fantastic series so far. I bought the book and it's great! Thanks