Oct-30-2022, 08:40 PM
It is the
input
on line 8 that is displaying the str
that prompt
points to.
how to make sure an input is from the wanted type
|
||
Oct-30-2022, 08:40 PM
It is the
input on line 8 that is displaying the str that prompt points to.
Oct-30-2022, 09:02 PM
i think i have got it, thank you !
Oct-31-2022, 06:09 AM
(Oct-30-2022, 07:46 PM)astral_travel Wrote: okay thank you Dean,That is not the kind of questions you should be asking. You should figure that out by yourself. I assume you are using some sort of IDE that allows single stepping through programs. If not, download one immediately! Using the debugger in your IDE, single step through the program. When is the message printed? Was it when the variable is assigned or somewhere else? You will learn much faster if you poke around inside programs to learn how they work.
Oct-31-2022, 09:09 AM
Over two years ago, you got a reply from ndc85430, that covered this exact topic (https://python-forum.io/thread-25302.html)
Maybe you should go back and check what you've posted and what answers you got, that way you can learn from what others have taken the time and trouble to post. You can also learn a good deal of the basics (as well as more advanced topics) from the likes of https://www.w3schools.com/python/, among others.
Sig:
>>> import this The UNIX philosophy: "Do one thing, and do it well." "The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse "Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Oct-31-2022, 01:25 PM
rob101 - i think that in the thread you directed me to - the question was different, and the code there is obviously much more simpler and less well written...
deanhystad - thank you for the answer, i have PyCharm Community, but i don't know exactly what to do - do i simply put on the red dot on the left side and run the debug, i really haven't tried before what you suggest i really am not trying to get easy answers, sometimes i just don't know, but i look up in different websites to find answers, it's only when i haven't found an answer elsewhere is when i ask here for clarifications...
If you validate the user input, you don't need to raise an exception.
Some input is easy to validate; this is one such case: a integer number between 1 and 10.
Sig:
>>> import this The UNIX philosophy: "Do one thing, and do it well." "The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse "Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Oct-31-2022, 04:11 PM
ok rob101 thank you, this helps me much, thank you !
| ||
|