Try / Except | Python | Tutorial 27

Try / Except | Python | Tutorial 27

Giraffe Academy

6 лет назад

65,744 Просмотров

Source Code - http://www.giraffeacademy.com/programming-languages/python/ This video is one in a series of videos where we'll be looking at programming in python. The course is designed for new programmers, and will introduce common programming topics using the python language.

Throughout the course we'll be looking at various topics including variables, lists, tuples, loops, conditionals, object orientation, and much more.

Тэги:

#Programming
Ссылки и html тэги не поддерживаются


Комментарии:

Ranjana Dissanayaka
Ranjana Dissanayaka - 13.09.2023 19:16

Extremely effective teaching..... I never understood try and except but you explained it perfectly... I finally understand this now.

Ответить
szymonozimek
szymonozimek - 08.06.2023 23:08

<3

Ответить
محمد kosa
محمد kosa - 23.03.2023 17:07

thx bro

Ответить
Santa Claus
Santa Claus - 28.02.2023 08:13

Thank you

Ответить
Teacher inThailan
Teacher inThailan - 20.02.2023 20:13

Awesome!! That helped me a lot. Thanks.

Ответить
emjay
emjay - 17.12.2022 08:16

Thanks. I get what you're saying, but it's not working in my code. I'm doing the silly number guessing game. I don't know if anyone is still visiting here and wants to help. I hate going on stack overflow because I'm too much of a noob and everyone complains that posts are repetitive, search other posts, blah blah. Can't even post there without someone making you feel like an idiot. I am an idiot, but I'm trying.

My problem is I have this outside a while loop....

guess = int(input("Pick a number between 1 and 10: "))

Then this is in the while loop
if guess < 1 or guess > 10: print("out of scope, guess again")
elif guess < number: print("Higher: ")
elif guess > number: print("Lower: ")

I want to account for a user that inputs a float (1.1), comma (1,000), or string (one, two, etc..)

I don't know where to put the try block or if I need to have multiple blocks. Maybe put all my code in it. I don't get it. I saw someone once raised an exception, so maybe I can raise exceptions without a try block? Is that easier?

Well, if anyone chimes in, I appreciate it. If not, I'll continue living my life of misery.

Ответить
Bilal Benboudissa
Bilal Benboudissa - 13.11.2022 15:17

thans for your efforts

Ответить
Marko Ynchausti
Marko Ynchausti - 27.10.2022 21:16

great video thank you so much! You are a great teacher.

Ответить
UCHE_Chimeziri coded
UCHE_Chimeziri coded - 20.10.2022 16:42

Thank you

Ответить
Stefano Zevallos Reyes
Stefano Zevallos Reyes - 12.10.2022 04:59

great video, short and straight to the point.

Ответить
Sacha Roset
Sacha Roset - 13.08.2022 06:43

love it, helped a lot thx !

Ответить
Jayesh N
Jayesh N - 10.07.2022 09:00

🙏🎉💐

Ответить
екатерина седых
екатерина седых - 15.05.2022 22:57

Mesej yang jelas, struktur yang jelas, mudah difahami, terima kasih

Ответить
JJJ J
JJJ J - 27.04.2022 06:52

Good explanation. Not too complex for us newbies . . . .

Ответить
Mary J
Mary J - 04.03.2022 04:43

Why is the try block have a green wiggly line?

Ответить
Karina Souza
Karina Souza - 12.01.2022 02:56

Thank you! Very clear explanation!

Ответить
Ezequiel Martinez
Ezequiel Martinez - 18.12.2021 06:18

so why write a code that you know can fail? I'm kind of confused on why use this kind of structure.

Ответить
Anurada Senaratne
Anurada Senaratne - 09.12.2021 11:01

thatt was beautiful man, thank you , im noobie and i was struggling with a few errors

Ответить
Lener
Lener - 19.08.2021 19:10

Which IDE do you use?

Ответить