My first thirty day challenge
I am doing a Python programming refreshing course by freecode camp. This is the first day of a 30-day challenge that I put in place to help me be consistent. I will be doing a minimum of 4 hours a day and I'll be striving to document what I've learned in the process. I hope to find this process fruitful as well as enjoy the pain.
Being day one, I started by looking at what the course will be covering. It is a 10-hour plus course covering the basics of python, and also Django, as well as Django REST framework for the backend. I started with learning python basics. So I learn the python data types, which include: strings, float, integers, and booleans.
A string consists of plain text. Integers are numbers while floats on the other hand are decimals. Boolean is true or false. These are the data types found in the Python programming language. I also learned about functions, which is a block of code that performs a particular task. For example print() function prints whatever is put in the brackets. There are user-defined functions as well as built-in functions. These functions are used to perform various tasks in our programs, for instance, to add integers together, we'd do print(78+22)
, which would give us 100. Here we've used the addition function and the print function.
We can also other functions that are not readily available in python by using the import function, for instance, to import a maths function, we'd run: from math import , which enables us to use other maths functions such as sqrt() to find the square root of a number.
The input() function is used to prompt users to enter their input into our program. We can assign variables to these inputs in order to display them. Variables are user-defined containers that hold any information or items, for instance, *name = 'Eliud' is a variable containing a string. Now to capture the user input we could do: name = input('Enter your name: ')
the phrase 'Enter your name:' is what gets displayed to the user. To capture and show what the user has input we'd run: print(name)
.