Variables are a way of ____ pieces of data in your program. When you create a ____, an area of the computer’s ____ is ____ for you and the ____ is stored in it. This area of memory is now ____ by you: you can ____ data from it, ____ the data, or get rid of it all together. To create a ____ in Python you give it a ____ and make it ____ to a value. This is known as ____. For example my_variable = "some useful data" Next you will ____ your program to store your name in a ____ and then display it. Add the following ____ to the bottom of your ____ to create a new variable called ____ to hold your name. my_name = "Martin" You should put your name (or any other name you like!) in ____ the ____ marks: "Martin". When your computer ____ this ____, a variable called my_name will be ____ and the text of your name will be ____. Once a variable has been ____, it can then be used in your program. Use print to ____ your name to the screen by adding this code to the bottom of your program. print(my_name) Notice how when using print you put the name of the ____ between the () instead of ____. The print instruction will ____ the value from the my_name variable and ____ it. ____ your program to see your name ____ under the first 2 print statements. Tip: a common problem is to put the variable name inside ____ ____, e.g. print("my_name"). (What will this do? If you are not sure, ____ it!) You can improve the message by putting the text “My name is “ in ____ of your name.____ the ____ to add the text "My name is " before the ____ ____: print("My ____ is " + my_name) Note the use of the ____ sign to add the ____ piece of text to the text in the variable. ____ pieces of text ____ like this is known as ____. ____ your program. Reflect: ____ line of code would you change if you wanted the ____ printed line to say “My name is ____ instead? (There may be ____ than one answer!)

بواسطة

لوحة الصدارة

النمط البصري

الخيارات

تبديل القالب

استعادة الحفظ التلقائي: ؟