Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts
Amazon Auto Links: No products found.
when i type in a non integer for this, it doesnt ask for a favorite number again it gives me a nameerror
I had to use “NameError” instead of “ValueError”, I’m guessing because I’m using Python 2.7.13.
Thanks for great tutorial, Bucky.
Please stop humming before every sentence
why do we need to put try?
is there a way to print out the exception? like print(str(except)
Getting NameError
what to do???
that’s very useful
has the zeroDivisionError stopped working in 3.6? doesnt seem to work for me
using python 3.6 and getting this error:
SyntaxError: unexpected EOF while parsing
How can i solve ?
King,
Could someone explain the purpose of the “while True:” before the try statement. It seems like we would never exit the loop because we never explicitly return false. I’m coming from java so its also weird that there is no object attached with “True”.
why you don’t teach about codes you write…. what is a int, input, and except when we learn about them ??
while True:
try:
number = int(input(“what’s your fav number?”))
print(“Wow, “, number, ” Is my favorite number too!”)
break
except ValueError:
print(“Please enter a valid number.”)
What’s the difference between NameError and ValueError. I get NameError instead of ValueError.
Dude, you helped me with Android, now you are helping me with python 🙂 god or whatever you believe in, bless you!
i am new to python coding ,
can you tell me how to raise custom exception in python?
I think Thenewboston is one of the best channels on YouTube… I have learned a lot here and There is no knowledge that is not power! – Mortal combat
hi i am getting
UserWarning: No parser was explicitly specified, so I’m using the best available HTML parser for this system (“lxml”). This usually isn’t a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 20 of the file test.py. To get rid of this warning, change code that looks like this:
BeautifulSoup(YOUR_MARKUP})
to this:
BeautifulSoup(YOUR_MARKUP, “lxml”)
markup_type=markup_type))
Dude just change your theme to intelliJ
Good!
The title tells me Bucky likes Paramoe.
how to add the “true” Module?
((name ‘true’ is not defined))
Serious question: I’m pretty curious on whether the fucking NullPointerException that always waste my a lot of time exist in Python as well?
I like to ask the user for their first input before I enter the while loop. Then for example I try to get the integer, and if I have a ValueError, I can already ask for an input in the exception, then repeat the loop and try to convert to a an int, etc.
Yep your cool. Bucky! You are literally my favorite programming teacher ever.
Why can’t I use boolean here when dealing with the except keyword ?
Thanks for helping! I wonderd why my code did not work: had to change to an integer.
Anyway awsome tutorial as always!
hahah, i had to learn this the hard way xD
I don’t get the answer in decimals. Why is that?
If I divide by a number higher than 18 then I get a zero, why is that?
while True:
try:
number = int(input(“What’s your fav number boss?n”))
print(2/number)
break
except ZeroDivisionError:
print(“Zero isn’t a number”)
except SyntaxError:
print(“Make sure you enter a number.”)
except NameError:
print(“Wrong once more, please try again.”)
except TypeError:
print(“You’re not very good at this, are you? try again.”)
except:
break
finally:
print(“loop complete”)
I have a question, running the source from this video.. I was surprised when the return value came back as a “FLOAT”, when you specifically “casted” the input value as a “INT”.. 3 entered / 6.0 returned..
are INT’s & FLOATS interchangeable in Python 3.6? (having a PHP background, they are not the same).. but i just seen it with my own eyes.. lol
can you please upload a video on the topic – using debugger in pycharm….
i kind of don’t know how to use a debugger
but if you remove the (int) it would fix it, you could type words and numbers
you are the one that made me wanted to program more in python because you make it sound so interesting so i linked you in my channel (OmeglaWaffles101) and i subscribed
sir if we gievn value
like mama = str(input(“what is your number?n”)
print(mama)
then output will come int and string value both r accepted why sir
10/10 Title
I did’t get a zerodivisional error when i multiplied 0/18
while True:
try:
number = int(input(“what is your fav colorn”))
print(18/number)
break
except: ValueError
print(“enter a valid number. “)
——————————————————————————————-
C:Python34python.exe “C:/Users/Chinese Cyber Army/PycharmProjects/untitled/First.py”
what is your fav color
0
enter a valid number.
what is your fav color
1:24 … durrrr… Tom Dwan … anybody?
I dont know why but I like the channel display picture so much..!!!