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!)
0%
Program two variables
共用
共用
共用
由
Robert272
編輯內容
列印
嵌入
更多
作業
排行榜
顯示更多
顯示更少
此排行榜當前是私有的。單擊
共用
使其公開。
資源擁有者已禁用此排行榜。
此排行榜被禁用,因為您的選項與資源擁有者不同。
還原選項
完成句子
是一個開放式範本。它不會為排行榜生成分數。
需要登錄
視覺風格
字體
需要訂閱
選項
切換範本
顯示所有
播放活動時將顯示更多格式。
打開結果
複製連結
QR 代碼
刪除
恢復自動保存:
?