My Favorite programming language: Python

in Zero to Infinity3 years ago (edited)


the-actual-symbol-of-the-Python-programming-language-in-front-of-lines-of-code-300x200.jpg
image source

cyxkEVqiiLy2ofdgrJNxeZC3WCHPBwR7MjUDzY4kBNr81LetETmuDWKvqCPmaSADqzr7cvw5uMJgEuBeuvuxazYG8zoQXWgA6qkN5Yo32DcRzka1VLsrb2BJSkBrF9yjpHU.png


Good day steemians, I am overjoyed for being able to take part of this contest organized by @zerotoinfinity community. It is an opportunity for me as a computer science student to take part as programming is part of the core courses I am doing. In fact, there are many programming languages. Few of such are; Java, Python, Javascript, C++, C#, CSS, Php, ruby, etc.
All the programming languages have its unique syntax that makes it differ from other programming languages. With regarding to the syntaxes, I chose python as my favorite programming language.

C3TZR1g81UNaPs7vzNXHueW5ZM76DSHWEY7onmfLxcK2iQMm1KRe2KsZpaQLHDyvnu8HoCxckZYePiSGvWaFNTvHbyziKpKp8aD4UViN7hj21qns4puxfci.png

Why is python my favorite programming language?

Python is a very simple language which is very straight forward syntax. It was created by Guido Van Rossum and was initially invented in 1989. The latest version of python is currently python 3. Python enables programmers to program without boilerplate code
Python is very identifiable and hence makes it a powerful programming language. This programming language is widely used in Artificial intelligence, Neural networks, natural language Generation and other advanced fields of Computer science. Below are the standard data types in python

  • Numbers
  • String
  • List
  • Tuple
  • Dictionary

Numbers

Python is capable of supporting four types of numbers .These are float, integer, complex and long
Integer(int): numbers which has no decimal.
Eg.
myint = 4

Float: Numbers which has a decimal point.
Eg.
myfloat = 4.0

Complex: numbers which has imaginary values. Eg 3.14j

long: Eg 1343142L

String

Strings must be in either single qoute or double quote.
Eg.
mystring = 'Hello'
mystring = "Hello"


List

List are one of the most versatile in python. A list consist of items which are separated by commas and are enclosed by square brackets [ ]. Values that are stored in a list can be access using ( [ ] and [ : ] ) with zero(0) being the beginning of the list and working their way to -1 as an end.
For example

list= [ 'abcd', '201', '1.52', 'John' ]

print(list)
print(list[0])
print(list[1:3])
print(list[2:])

This is the result

IMG_20210724_221114_081.JPG

Tuples

Tuple is another data type which is similar to list. The items in tuples too are separated by commas. The main difference between tuple and list is that; list are enclosed within brackets[ ] and elements in it can be altered, whilst elements in tuples are enclosed in parentheses() and can not be Change.


Dictionary

Unlike list and tuple, dictionary elements are kept in curly brackets{ }
Eg.
Person = { " first_name": "bravo3", " last_name": "Joseph"}
The relsult

IMG_20210724_212919_911.JPG

C3TZR1g81UNaPs7vzNXHueW5ZM76DSHWEY7onmfLxcK2iQMm1KRe2KsZpaQLHDyvnu8HoCxckZYePiSGvWaFNTvHbyziKpKp8aD4UViN7hj21qns4puxfci.png

Some basic arithmetic in python

OperatorDescriptionExample
+Addition5+3
-subtraction5-3
*Multiplication5*3
/Division5/3
**exponentiation5**3
%Remainder5%3
//floor division5//3

C3TZR1g81UNaPs7vzNXHueW5ZM76DSHWEY7onmfLxcK2iQMm1KRe2KsZpaQLHDyvnu8HoCxckZYePiSGvWaFNTvHbyziKpKp8aD4UViN7hj21qns4puxfci.png

Functions

Functions are built to structure programs. Most programming languages recognize functions. Below are few functions which can use to format data data which can be altered in python.

append() method: this is use to add a list to another list.
Eg.
list= [ 'abcd', '201', '1.52', 'John' ]
list2 = [ 10, 'bravo3' ]
list.append(list2)
print(list)
This will output

IMG_20210724_211915_178.JPG

Getting the length of a list
We can get the length of list using len() method
Eg.
list= [ 'abcd', '201', '1.52', 'John' ]
print(len(list))
The output will be:

IMG_20210724_211740_635.JPG

We can also add or remove item into and from a list.
Eg.
list= [ 'abcd', '201', '1.52', 'John' ]
list.pop() # removes the last value in the list

print(list)

The result
IMG_20210724_212041_427.JPG

Note: comment does not execute by python. We write single line comment in our codes by starting it with # follow by the comment statement.
Multiple line comment is done by either writing it between single triple quote(''' )or double triple quote.(""")


Python also takes input from the user using the syntax input()
Eg.

IMG_20210724_221353_159.JPG
source code


IMG_20210724_221440_478.JPG
result


IMG_20210724_221554_126.JPG
I entered my name

C3TZR1g81UNaPs7vzNXHueW5ZM76DSHWEY7onmfLxcK2iQMm1KRe2KsZpaQLHDyvnu8HoCxckZYePiSGvWaFNTvHbyziKpKp8aD4UViN7hj21qns4puxfci.png

Below are aspects you can use the knowledge of python for;

  • Data Science
  • Web development
  • Machine learning
  • Scripting
    And many more

Conclusion

Python as a programming language whch contains simple syntaxes for easy understanding. There are many statement in python which is not include here, but I hope with this, you would get to know that python is a great programmable language one must learn if targeted of being one of the careers mentioned in the content already. My final regards goes to @zero-to-infinity for this great contest.

cyxkEVqiiLy2ofdgrJNxeZC3WCHPBwR7MjUDzY4kBNr81LetETmuDWKvqCPmaSADqzr7cvw5uMJgEuBeuvuxazYG8zoQXWgA6qkN5Yo32DcRzka1VLsrb2BJSkBrF9yjpHU.png

Thank you for reading

cyxkEVqiiLy2ofdgrJNxeZC3WCHPBwR7MjUDzY4kBNr81LetETmuDWKvqCPmaSADqzr7cvw5uMJgEuBeuvuxazYG8zoQXWgA6qkN5Yo32DcRzka1VLsrb2BJSkBrF9yjpHU.png

Sort:  

image.png

Nice to read your post .

Keep posting and stay with our community.

Thank you

You are very welcomed moderator

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.030
BTC 59956.07
ETH 2524.56
USDT 1.00
SBD 2.49