THIS WEEK ON AI CLASS

Python For Artificial Intelligence

Written by Neema Onesmo.

Python is a general-purpose, high-level,interpreted programming language, and it was first released in 1991. Python language emphasizes code readability and uses of significant white space. python’s constructs and object oriented approach aim to help programmers write clear, logical code for their projects.

Reasons for using python for AI and ML.

  1. Provides great choice of libraries.

Because of a lot of library python has become the most popular and best language foe AI and ML. Libraries are group of modules published by different sources that include some pre-written group of code that allows user to perform some actions and functionalities. They provide base items to help developer not to code them from scratch.Some of python libraries allow you to access,handle and transform data and so they become most helpful in ML since ML requires continuous data processing.

2.Entry barrier are minimum.

ML and AI industry deal with bunch of data that has to be processed in most effective and convenient manner. With minimum entry barrier python becomes the best language for AI development. Also it is easy to learn since it resembles normal English language and with simple syntax.

3.Provides Flexibility.

with python you can choose to either use Object Oriented Programming or Scripting.

With python we don’t have to recompile the source code, one can implement the change and see the results. Also we can combine python and other language to archive a certain goal. also allows a programmer to go with the style they are comfortable with and some times even to combine more than one style.

4.Python is platform independence Language.

python in machine learning development can run on any platform be it windows, Linux,Mac Os or Unix and other platform. Only some small scale changes has to be implemented with a developer to transfer the process from one platform to another.

Another reasons are like Readability, Growing popularity,Good visualization option and community support.

so in this week we have learn introduction part of Python Programming language

INTRODUCTION TO PYTHON:

We started with

(a) function print( ):

Function print allows us to display or instruct the computer to output the value passed in the console or window.

Example:

Print(“Hellow Everyone!”)

Output will be :

Hellow Everyone!

It was simple and because the output was seen, it motivated us to learn more and also made us know that python language is not difficult.

(b)data types:

There are two data types, String and Number.

These data are mostly stored in the variables.

Variables:

Variable hold a space for the variable value. the value of the variable can change.As the name itself “variable” means it is not fixed, it can vary.

Declaration of a variable is just a variable name.

Example:

name=”Prosperity”

age=13

As you might have notice when a variable value is a string it has to be within single or double quote i.e “ string” or ‘string’. And for numbers there is no need for quote.

Good news! We do not use semicolon in python language.

Then there was constant values: Python also acknowledge the constant values

Example:

Pi=3.14

gravity =9.8

( c ) List in Python.

List in python contain data that are ordered and changeable. and they allow duplicate member.Example of List declaration in Python.

K=[1,2,3,5]

where “K” is the List name and in list we use “Square brackets” [ ] And data of the list are written within the Square brackets.

List stores its data in zero base indexing format, i.e the firs data value in our example is “1" its position is in 0 indexing position value of the list.

Some operation that can be done with list.

we can retrieve the exactly data from the list by using its indexing position or a range of data from index a to d where a and d are exclusive.

K[:1]

output will be

1

K[1:4]

output

[2,3]

some function eg. max( ) in the list will return the maximum number in the list. in our example max(K) will return the value 5

we also went trough tuple, set and dictionary partially.

(d ) Inbuilt function:

We also discussed about the inbuilt functions in python and we found out they are so many so we discussed few of them.

bin(a): convert integer number in to binary string.

bool(d): returns a boolean value either “true” or “false”

help( ): provide a description help basing on the parameter that are in the parenthesis

max() & min() return the maximum value and minimum value.

Inbuilt function are too many in python language, and both of them perform a vital functionality and so this helps a developer not to create or write some code for a specific functionality that its function is already in python as a inbuilt function.

we also had a quiz to divide a name or string in to two equal halves using python language.

MY EXPECTATIONS:

To learn more and to be able to use python language for artificial inteligence and machine learning.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Next.JS dynamic image resizer is a game changer

Import Struct in Rust

Antiforgery Tokens Behind The Scenes

Implementing Scrum is like joining a gym

A few steps to protect your K8S cluster

Policy, Protect Access Controllers

Mysql repeated CONCAT operations optimization

Debugging NodeJS within a Docker Container on VSCode

DSG Community AMA 2 Recap

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
Neema Onesmo

Neema Onesmo

More from Medium

Why Do Programmers Need Algorithms at All?

Why functions are called First-Class Citizens in JavaScript

Installing ns-3.34 in Ubuntu 20.04

But what about Big-O?