Posts

Showing posts with the label programming

Graphing with Python using Matplotlib

Image
 Introduction Matplotlib is a graphing and plotting library that can be useful for creating different types of graphs and plots. Such as line charts, pie charts, scatter plots and 3D plots. Matplotlib can also be used for creating animated and interactive visualizations. It can also generate output in a variety of formats which includes PNG, SVG and PDF etc. Installing Matplotlib Matplotlib is not built into python. First, we need to install Matplotlib using the PIP package manager. pip install matplotlib If you are using Conda you can use the below command. conda install matplotlib You can refer to more about installation options on the Matplotlib installation page . Plotting Simple Graph using Matplotlib First, we need to import pyplot from Matplotlib library.  After that line, we give 2 python lists as arguments to plot()  function specifying Y values and X values for the graph. then we set the label for both the x...

Your First Rust Program - Hello World!

Image
 Introduction  Rust is a robust, reliable, productive language(check rust language benchmarks ). The language has all the tools to write program efficiently and It also has a well written userfriendly documentation. In this tutorial, we will write our first Rust programme on a Linux machine and Introduce some syntax rules in Rust language. Installing Rust in Linux. We can install Rust in Linux easily. To download and install Rust you just need to copy and paste the below command and press enter key then it will download and install Rust into your machine using a tool called rustup . rustup is a command line tool for rust installer and version management. curl --proto &apos ;=https &apos ; --tlsv1 .2 -sSf https: //sh.rustup.rs | sh terminal: bash-5.1$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh info: downloading installer Welcome to Rust! This will download and install the official compiler for the Rust programming lang...

Python Variables

Image
Creating a Python variable  In python, there isn't a way to declare variables what you can do is you can create a variable and assign a value same time.  name = "John" x = 8 You can use an expression as an assigned value in a variable. In the below scenario, expression evaluate first then that value is assigned to the variable on the left-hand side. value = 8 + 3 full_name = "John" + "Doe" Previously assigned variables can be used to build up the expression x = 6 y = 7 new_value = x + y Here x and y variables need to create earlier before it assigned to the new_value variable. You can also create multiple variables at once using a comma( , )   In the below example x , and y variables are created at once and assigned x to the value 6 and y to the value of  7 . x, y = 6 , 7 Nature of the python variables If you create python variables by assigning the same values then those vari...