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 代码
删除
恢复自动保存:
?