Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
In the previous exercise, we worked with two types of variables
integer, or int: a number without decimal part. bmi with the value 25 is an example of an integer. height with the value of 40 (in rectangle example) is also an integer.
float, or floating point: a number that has both integer and decimal parts. weight with the value of 72.25 is an example of a float.
Other common data types in Python are
str, or string: Represents sequences of characters such as a message or text. Variable my_name = "John" is an example of a string
Pro Tip - We can use either single or double quotes to represent strings.
Example - "John" (notice double quotes) and 'John' (notice single quotes) both are same strings
bool, or boolean: Represents logical values such as True and False.Variable is_great = True is an example of a boolean
Pro Tip - Notice capitalization in True and False. Capitalization is important for boolean variables in Python
gender, with the value "male"is_obese, with the value False
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...