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
מחיקה
האם לשחזר את הנתונים שנשמרו באופן אוטומטי:
?