You are on page 1of 1

Python Programming I – Honors 40460

Unit 1 – Python language basics, introducing data types, variables, input,


functions, operators, conditional statements, loops, and incrementing.
Module 1 – Python Basics
Getting Started with Python
 print() Students will be able to:
 Comments  Use Python 3 in Visual Studio
 Data types basics  Write working code using print() and #
 Variables comments
 Addition with Strings and Integers  Combine Strings using string addition (+)
 Errors  Add numbers in code (+)
 Character art  Troubleshoot errors
 Create character art

Activity 3 – Type Function


1. Open your IDE (azure, repl.it, VisualStudio, etc…).
2. Open a New Project.
3. Name it: U1_M1_A3-XX (XX represents your first and last name initials).
4. Insert your Program Comments.
5. Insert a line comment to identify each step, i.e.: # Step 6.
6. View this video: Type() Function, Video #1

Concept: print(type()) = returns the data type of the python objects. Example: print(type(3.3)),
print(type(3)), print(type(“school”))
NOTE: For IDE’s other than azure, the type function must be coded differently than shown in the video. Include the
print function or it will not display.
Example: type(3.3) should be coded as: print(type(3.3)) # this will display: float

When using type, the result will display the data type of the information in the parenthesis:
str = when python detects a string of characters (numbers, letters, punctuation…. ) in quotes
int = when python detects an integer (positive or negative whole number)
float = when python detects decimal numbers (i.e: 3.1569, 0.0, 9.9999, 5.0)

7. Code the statement to display the data type for: 3.14159.


8. Code the statement to display the data type for: 42.
9. Code the statement to display the data type for: “James Brown”.
10. Code the statement to show the data type for the variable bucket after assigning: bucket = 18.
11. Code the statement to show the data type after assigning: bucket = “Go Knights”.
12. Code the statement to show the data type for “Go Wolfpack”.
13. Code the statement to show the data type for ‘Go Panthers’.
14. Code the statement to show the data type for “12”.
15. Code the statement to show the data type for 12.
16. Code the statement to show the data type for -12.
17. Code the statement to show the data type for 12.0.
18. Code the statement to show the data type for 1.55.
19. Thoroughly test your code, check comments and then submit according to teacher instructions.
20. Take the activity quiz.

You might also like