My First Coding Experience

It’s interesting how the human mind always wants to try and learn new things, March 2020 I decided to start a career in tech with data science in view.

I started my first programming language, Python which I took on Progate credits to @hacksultan on Twitter for giving 150 people access through DevCareers yes!! 150, you should check them out, they are doing a great job for beginner developers in Africa.

Python is an open-source(free), general purpose and high-level language created by Guido van Rossum and first released in 1991. Python is simple and easy to understand and can be applied in web development, machine learning, finance, statistical processing and more.

My first line of code was print(“Hello World”), although I did not know exactly what I was doing at the moment, seeing the output was exciting. I will be sharing some things I learnt on Python in this article. Let’s kick start with Variables.

  • Variables

A variable is like a box having a name to store a value. In storing variables, it needs to be defined. The syntax is variable_name = value. Note that = in programming does not mean equal rather it means assigning a value. Also when picking a variable name, it cannot start with a number and if the variable contains two words or more, seperate with an underscore (_) like user_name. Naming variables are important because it makes your code easier to read.

Source: Progate

  • Data Types

A data type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Here are some data types in Python:

  • Integers: Whole numbers are called integers in programming (1,2,3,4,5….). You can add, subtract, multiply or divide these integers.
  • Strings: A string is a sequence of characters enclosed in single ‘ or double “ quotes. “Hello World” is a string the same as ‘3 + 5’.
  • Booleans: The boolean data type has two logical values, True and False. Booleans are applied with conditions, always remember to capitalize the first letters True and False.
  • Floats: Float data type are numbers with a decimal point (2.3, 4.6)
  • Tuples: Tuple data types are ordered immutable(unable to change values) sequence of values enclosed in curved brackets.
  • Lists: The list data type are ordered sequence of elements enclosed in square brackets [10, “hello”, 200.3]
  • Dictionaries: In dictionaries, a key is paired with a value to form one element enclosed in curly brackets {}.

Here’s a pictorial representation of two data types:

Source: Progate

Lastly, let’s talk about a control flow in Python:

  • Control Flow

A control flow is the order in which the program’s code executes satisfying a certain condition.

Source: Progate

  • IF Statement: the IF statement is used to write code that gets executed under a certain condition. Syntax- IF conditional expression :. Remember not to forget the colon, continuous practice made me not forget. The code only runs when the condition is true. Also, you must indent your next line of code after the IF statement.
  • ELSE Statement: the ELSE statement is used to add code you want to run when the condition of IF statement is false. Syntax- Else:
  • ELIF Statement: the ELIF statement is used to alternative conditions to the control flow.

Additionally you can combine conditions in the IF statement with: and, or, not. The equality operators that can be used in an IF statement : == when the two values are equal and != to see if two values are not equal. Comparison operators in control flow include: (<,<=,>,>=).

The image below shows a control flow with all the statements I have discussed.

Source: Progate

You wanna hear my thoughts, Python has a clear and intuitive syntax and I’m glad I started with Python. I have just shared a bit of what I learnt with you, feel free to leave comments.

Yes!! Progate makes coding fun for beginners.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store