When started this journey in tech there were a lot of noises saying python is the easiest programing language this played a very crucial role in my interest in learning python, not saying that I wanted things easily is because at that time academic pressure was killing me. After I started learning it I noticed the noises were wrong PYTHON IS NOT THE EASIEST PROGRAMING LANAGUAGE infact I think they meant powerful.
Fast-forward I developed a habit of leaning it everyday to understand all the nitty gritty of python
Here is what I learned from in a systematic way :
Variables
This is just a name that points to a value.
example
age =26
name = "Frankline"
*Data type
*
a data type classification that defines the category of a value, determining how the computer stores that data and what kinds of operations can be performed on it.
type of data type
1.Integer - whole numbers
total_bookings = 285
2.Float - decimal numbers
average_amount = 31688.42
3.String - text, in single or double quotes
name = "Alice Mwangi"
4.Boolean - True or False
is>18= False
5.List - an ordered, changeable collection
scores = [78, 85, 91, 65, 72]
6. Dictionary - key-value pairs
booking = {"booking_id": "BK0001", "room_type": "Deluxe", "total_amount": 25000}
if you want to print the output you use
print()
example
print(name),
print(is>18)
INPUT AND OUTPUT
INPUT
Pauses your program and waits for the user to type something whatever they type comes back as a string, even if it looks like a number.
this demonstrate how input works plus the output when you print ()
The f-string
the f-string is a way to insert variables directly into print
example
Top comments (0)