Python 2.10 : Rescue buoy : print, input, str, int, try
We are going to continue our code with an emergency buoy, Here we will make a summary of all the topics we have discussed above. It should be noted that when using variables we must always remember to declare them, that is to say, If I take the variable name and initialize it to a character string because input is a function that has a character string as a parameter, and we should note that python is sensitive to the case as well as java. If I do for example name with a capital n and I don't change the name here I launch my code it asks me the name whatever I enter the age, you see there is an error at this level you have to try to read the error, we look at line 15 it's a NameError type error on line 15 it means that we didn't name the name as it should have been so we have to be very careful when we declare the variables and when we call this variable we also have to note that when declaring this variable there is no space, if I don't do example name of the person, you'll see that it's underlined in red you'll see that it's an error We never write the names of variables with spaces, at worst you can put the dash of 8 at this level, these are the little remarks that should be noted. We will now see the difference between a plus and a comma, I'll start with the comma, I'll do a print parenthesis double side I put anything in the string and then I put a comma double side I continue, if I run my code you will see that normally displays in fact this comma allows you to enter several parameters in the print function and now if I copy this and I put at the bottom and instead of the comma I put a plus you'll see that it's different because the plus allows you to do the concatenation, and if I add for example a number I put for example 123 and I launch my code there is an error on line 7 because it says that it is an int whereas the other one is of type string and to concatenate I must put a str parenthesis I relaunch, everything works normally it is good at this level. Well we have seen the int and the str, we can write our code differently at this level I will copy this and replace it at this level and put this in comment if I restart my program, here already there is an error because age next is not defined anymore and to remedy that we have to make an int at this level that is another way to make this code and put here age plus 1, I restart my code you see that everything works normally. We say to very on a video on the loops while