Download in
Google Play
3
Share
Save
Sign up
Access to all documents
Join milions of students
Improve your grades
By signing up you accept Terms of Service and Privacy Policy
Sign up
Access to all documents
Join milions of students
Improve your grades
By signing up you accept Terms of Service and Privacy Policy
Sign up
Access to all documents
Join milions of students
Improve your grades
By signing up you accept Terms of Service and Privacy Policy
Activity 3.2.1 Where does the name 'Boolean' come from? Boolean variables are named after George Boole who invented the mathematics of digital logic. Find a picture of George Boole and insert it here. ● When was he born? 2 November 1815 3.2 Variables and Data Types Activity 3.2.2 Data types Use the 'type' function to find out the data types for these values: ● >>>type("Fred") >>>type(198) int >>>type(88.9) float >>>type(True) bool >>>type(False) bool Hint: Remember that True and False must start with a capital letter. Activity 3.2.3 Expression "hello world" False 15 35.6 -999 "15" "False" True 0.001 The type function returns the data type of an expression. For each of these expressions, first predict the data type then use the type command to see if your prediction was correct. ● str Predicted data type string boolean integer float integer string string boolean float Activity 3.2.4 The interactive shell is a useful place to explore variables. Copy and run this code in the interactive shell: myName="Fred Smith" myAge=14 print(myName, myAge) Fred Smith 14 Type command type("hello world") type(False) type(15) type(35.6) type(-999) type("15") type("False") type(True) type(0.001) Result string boolean integer float integer string string boolean float Create a variable called myName and assign it to your name. myName="Lilac Osborne" Create a variable called myAge and assign it to your age myAge=15 Create a variable called myEyes and assign it to your eye colour. myEyes="brown" ● Create a variable called myHeight and assign it to your height. MyHeight="5'8\"" Write the commands to display on the screen your name, age, eye colour height. myName="Lilac Osborne" my Age=15 myEyes="brown" myHeight="5'8\"" print(myName,myAge,my Eyes, myHeight) Hint: Remember that a single '=' is used to assign a value to a variable. Activity 3.2.5 Variable...
iOS User
Stefan S, iOS User
SuSSan, iOS User
names A programmer is trying to decide on a valid name for a variable that represents a house number. Which of the following variable assignments are valid? Why are the others not valid? Reason why not valid 8HouseNumber = 288 houseNumber = 288 house Number = 288 house_number = 288 import = 288 Valid or invalid variable name? invalid Valid invalid Valid invalid Starts with a number Space between the words Import is a built in function What type of error do you get when using an invalid variable name? Invalid syntax Activity 3.2.6 Copy and run this code and explain the result: # Programmer Amy Jones 12/8/2013 # adds two numbers Activity 3.2.7 Data types in Python Complete this table to describe the four data types. Data type Python Explanation abbreviation string numberOne=15 numberTwo=23 answer=numberOne + numberTwo print("The answer is ",answer) integer float boolean int str float bool A whole number Sequence of characters that cannot be changed Numbers with decimal points True False Example (100) ("hello") 18.0 True Hint: Quotation marks are used to show the start and end point of a string, e.g. "this is a string".
3
Share
Save
Los
160 Followers
computer science worksheet with answers python
160 Followers
0
4
Print statements,data types,comments,variables (will be doing more soon !!)
0
Y8 - Computer Science Programming Key Terms
43
This guide and summary of python will allow you to understand the basics of python coding and allow you to do basic coding which you can then develop into advanced coding
4
Learn about Bubble, Insertion, and Merge sort algorithms, their advantages, disadvantages, and examples. Understand how each sort works for exam preparation.
0
notes for everything we need to know for the nat 5 computing science exam in the software section(from achieve and from my class notes)
Activity 3.2.1 Where does the name 'Boolean' come from? Boolean variables are named after George Boole who invented the mathematics of digital logic. Find a picture of George Boole and insert it here. ● When was he born? 2 November 1815 3.2 Variables and Data Types Activity 3.2.2 Data types Use the 'type' function to find out the data types for these values: ● >>>type("Fred") >>>type(198) int >>>type(88.9) float >>>type(True) bool >>>type(False) bool Hint: Remember that True and False must start with a capital letter. Activity 3.2.3 Expression "hello world" False 15 35.6 -999 "15" "False" True 0.001 The type function returns the data type of an expression. For each of these expressions, first predict the data type then use the type command to see if your prediction was correct. ● str Predicted data type string boolean integer float integer string string boolean float Activity 3.2.4 The interactive shell is a useful place to explore variables. Copy and run this code in the interactive shell: myName="Fred Smith" myAge=14 print(myName, myAge) Fred Smith 14 Type command type("hello world") type(False) type(15) type(35.6) type(-999) type("15") type("False") type(True) type(0.001) Result string boolean integer float integer string string boolean float Create a variable called myName and assign it to your name. myName="Lilac Osborne" Create a variable called myAge and assign it to your age myAge=15 Create a variable called myEyes and assign it to your eye colour. myEyes="brown" ● Create a variable called myHeight and assign it to your height. MyHeight="5'8\"" Write the commands to display on the screen your name, age, eye colour height. myName="Lilac Osborne" my Age=15 myEyes="brown" myHeight="5'8\"" print(myName,myAge,my Eyes, myHeight) Hint: Remember that a single '=' is used to assign a value to a variable. Activity 3.2.5 Variable...
Activity 3.2.1 Where does the name 'Boolean' come from? Boolean variables are named after George Boole who invented the mathematics of digital logic. Find a picture of George Boole and insert it here. ● When was he born? 2 November 1815 3.2 Variables and Data Types Activity 3.2.2 Data types Use the 'type' function to find out the data types for these values: ● >>>type("Fred") >>>type(198) int >>>type(88.9) float >>>type(True) bool >>>type(False) bool Hint: Remember that True and False must start with a capital letter. Activity 3.2.3 Expression "hello world" False 15 35.6 -999 "15" "False" True 0.001 The type function returns the data type of an expression. For each of these expressions, first predict the data type then use the type command to see if your prediction was correct. ● str Predicted data type string boolean integer float integer string string boolean float Activity 3.2.4 The interactive shell is a useful place to explore variables. Copy and run this code in the interactive shell: myName="Fred Smith" myAge=14 print(myName, myAge) Fred Smith 14 Type command type("hello world") type(False) type(15) type(35.6) type(-999) type("15") type("False") type(True) type(0.001) Result string boolean integer float integer string string boolean float Create a variable called myName and assign it to your name. myName="Lilac Osborne" Create a variable called myAge and assign it to your age myAge=15 Create a variable called myEyes and assign it to your eye colour. myEyes="brown" ● Create a variable called myHeight and assign it to your height. MyHeight="5'8\"" Write the commands to display on the screen your name, age, eye colour height. myName="Lilac Osborne" my Age=15 myEyes="brown" myHeight="5'8\"" print(myName,myAge,my Eyes, myHeight) Hint: Remember that a single '=' is used to assign a value to a variable. Activity 3.2.5 Variable...
iOS User
Stefan S, iOS User
SuSSan, iOS User
names A programmer is trying to decide on a valid name for a variable that represents a house number. Which of the following variable assignments are valid? Why are the others not valid? Reason why not valid 8HouseNumber = 288 houseNumber = 288 house Number = 288 house_number = 288 import = 288 Valid or invalid variable name? invalid Valid invalid Valid invalid Starts with a number Space between the words Import is a built in function What type of error do you get when using an invalid variable name? Invalid syntax Activity 3.2.6 Copy and run this code and explain the result: # Programmer Amy Jones 12/8/2013 # adds two numbers Activity 3.2.7 Data types in Python Complete this table to describe the four data types. Data type Python Explanation abbreviation string numberOne=15 numberTwo=23 answer=numberOne + numberTwo print("The answer is ",answer) integer float boolean int str float bool A whole number Sequence of characters that cannot be changed Numbers with decimal points True False Example (100) ("hello") 18.0 True Hint: Quotation marks are used to show the start and end point of a string, e.g. "this is a string".