Condition IF in Python

Condition IF in Python

Condition IF in Python

We use the IF statement in programming to run a group of statements but only when a condition is met.

In this section, we want to introduce the syntax and examples of Condition IF in Python.

IF is one of the conditional commands that is very widely used in programming and learning it is recommended to everyone.

There are three forms of the IF In Python:

  1. if
  2. if  else
  3. if   elif   else

elif allows to check multiple statements for TRUE and if one the condition was True then it execute those statements.

else: if all conditions were False then the last condition in ‘else’ will execute at the end.

we must know the conditional elements and here there are some elements:

a==b              Is a equal to b?

a !=b              Is NOT a equal to b?

a < b              Is a smaller than b?

a > b              Is a greater than b?

 

for using IF we have three steps:

if condition1:

statement a

if it’s True then compiler run it and skip others condition

elif condition2:

statement b

and if last IF was False then compiler check this part and if it’s True then compiler execute it and skip other conditions

elif condition3:

statement c

we can have another IF and if last ELIF was False then compiler check this part and if it’s True then compiler execute it and skip other conditions

else:

statement d

All conditions were False, and compiler runs this.

 

For Example:

if a > b:

    print (‘Yes’)

elif a < b:

    print (‘No’)

else:

    print (‘Equal’)

 

Nested IF in Python:

We can merge several IF into a single IF statement and this is called Nesting in programming languages.

First Condition: if condition1:

Second Condition: if condition2:

Third Condition: if condition3:

statement a

elif condition3-1:

statement b

else:

statement c

 

let’s to see video from our YouTube channel

If you want to learn more Python, please click here.

Problems running Hyper-V & VirtualBox

Problems running Hyper-V & VirtualBox

Problems running Hyper-V & VirtualBox

 

The use of virtual machines is being used day by day. In companies, institutions and even at home for practice and learning. We can install virtual machines on personal computers that have minimal functionality. When we install these softwares on Windows 10 or 11, in some cases, problems arise to run it. One of them is, “Problems running Hyper-V & VirtualBox” at the same time. Here we are going to explain how to solve this problem.

If you installed Hyper-V and you want to install VirtualBox, you will have this issue:

mes you get error to run these two, together. In this tutorial we teach you how you can disable Hyper-V and use VirtualBox.

Here is the command to disable Hyper-V to solve this problem

  • bcdedit.exe /set hypervisor launch type off

After running this command, you must Restart the computer, and try after that.

Here is the command to enable Hyper-V
  • bcdedit.exe /set hypervisor launch type auto

note: you must restart the computer

 

You can find some learning for this topic here:

Backup and Recovery

Backup and Recovery

Backup and Recovery

In this part we want to know, what is Backup and Recovery? Backup refers to storing information in external memory to protect information from accidents and loss. Recovery refers to returning data from a saved copy to the original location or to an alternate location where information has been lost or damaged.
To store information, we use a separate system or media such as virtual hard drives, data storage servers or cloud storage space to protect them against the possibility of data damage.

Why do we need backups?

Why do we need backups? By making a backup copy, we make a copy of the information in a peripheral memory so that we can recover it in case of damage to the primary data. Primary data failures usually occur for the following reasons:

  • Hardware defect
  • Defect in the software
  • Corruption of information
  • Human error – accidental deletion of data
  • Attack of viruses or malware

by having a backup copy of the data, we can restore it from the initial point in time.

Having a copy of information in an external space is very vital and necessary to prevent information loss. This additional copy can be, for example, an external hard drive or a USB memory or a disk storage system or Cloud storage:

  • The source device (a workstation),
  • Your local backup device (External HDD),
  • Off-site location (Cloud backup solution).

 Backup solutions:

  • File-only backup,
  • Server backup,
  • Desktop backup

Backup methods:

There are two general methods for backup:

1. Field or traditional method:

Data is serially backed up using a backup server or software. The backend server retrieves the data and indexes, compresses, and encrypts the data for optimization and easy search before sending it.

2. Array-based method:

This backup method is based on array. The way this method works is based on Snapshots, which provides an alternative for data protection.

The advantages of this method include:

    • High performance on personal memories
    • Low pressure on memory
    • Higher service level to provide more backup copies
    • Productivity and high efficiency of stored data
    • Easier and faster use of data alignment

 

If you are interested in seeing some learning you can click here.

 

Variables in Python

Variables in Python

Variables in Programming Language Python

The programing languages store data in the form of Variables. Every variable has data type, name, and a value assigned to it. Variables are assigned places in the computer memory to store data in which they can be known or unknown based on the value given to them. Also, they can be used for more than one value. They can tag and store data in memory and we can recall them when we need them. In this section, we want to introduce the most used Variables in Python. In Python, we have four commonly used groups of variables, which are integers, decimal numbers, strings, and binary (true or false).

Python-Variable-Type

  1. int
  2. float
  3. str
  4. bool (binary)

 

Variables in Python – int:

this variable is for integers number such as 0-9:

For example:

We assign number ‘5’ to ‘a’:

      • >>> a=5
      • >>> type (a)
      • <class ‘int’>

If we try to back integers of a float number, we try this command:

      • >>> int (4.9)
      • 4
      • >>> int (4)
      • 4

also, with can use general math with Python:

      • >>> 6*8
      • 48
      • >>> 8+6
      • 14
      • >>> 15*5.1
      • 76.5
      • >>> 21//3
      • 7
      • >>> 21/3
      • 7.0
      • >>> 21%3
      • 0
      • >>> 22%3
      • 1
      • >>> 2*5
      • 10
      • >>> 2**5
      • 32

Float:

We assign number ‘4.5’ to ‘b’:

      • >>> b=4.5
      • >>> type (b)
      • <class ‘float’>

 

      • >>> float (5.5)
      • 5.5
      • >>> float (5)
      • 5.0
      • >>> int (float(5.5))
      • 5

If we want to have more math command, we can use ‘math’:

      • >>> import math
      • >>> math.ceil(5.5)
      • 6
      • >>> math. Sin (6)
      • -0.27941549819892586
      • >>> math. Cos (6)
      • 0.960170286650366

String:

We assign ‘hello’ to ‘c’:

      • >>> c= ‘hello’
      • >>> type (c)
      • <class ‘str’>

for indexing in String, we must now three steps: [start:stop:step], all command to use for String is inside these three steps:

indexing [start:stop:step]

      • >>> c
      • ‘hello’
    • Show first character:
      • >>> c[0]
      • ‘h’
    • Show Second character:
      • >>> c[1]
      • ‘e’
    • Show third character:
      • >>> c[2]
      • ‘l’
    • Show last character:
      • >>> c[-1]
      • ‘o’
    • Show first three character:
      • >>> c[0:3]
      • ‘hel’
      • >>> c[0:2+1]
      • ‘hel’
    • Show each 2 character like 1.3.5….:
      • >>> c[::2]
      • ‘hlo’
    • Show reverse character:
      • >>> c[::-1]
      • ‘olleh’

If we want to have more math command, we can use ‘String’:

    • Confirm lower or upper of character:
      • >> import string
      • >>> “a”.islower()
      • True
      • >>> “A”.islower()
      • False
      • >>> “a”.isupper()
      • False

Bool (binary)

      • >>> b = True
      • >>> type (b)
      • <class ‘bool’>
      • >>> c= False
      • >>> type (c)
      • <class ‘bool’>
      • >>> b
      • True
      • >>> c
      • False
let’s to see video from our YouTube channel

 

If you want to learn more Python, please click here.

Types of Network Security

Types of Network Security

What types of network security do we have?

We divide the Types of Network Security into two parts:

 

  • Software programs
  • Hardware parts

The best choice is to use both (software and hardware) together. Software programs such as Anti-worms, Anti-viruses, Firewalls, etc. Hardware components also include firewalls. It can control and scan the input and output ports. Microsoft has provided this feature for its users in Windows, but this software alone does not provide sufficient computer security.

Some examples of strong anti-malware programs are Antivirus, Symantec, Kaspersky, Nod32, Bitdefender, Norton, Panda, Mac

For hardware parts, you can mention Cisco ASA or Astaro Firewall. The best and safest solution for large organizations is to use two hardware devices at the same time, so that if one of them has a problem, the second device can continue working.

One of the most important actions in network security is to prepare a backup copy of information and files on a backup server. In terms of security, if there is an attack and a failure occurs in the files or the system, we must be able to read the backup immediately after cleaning the system.

Security in wireless networks:

in the topic of types of Network Security, since wireless networks are expanding every day and cable networks are becoming obsolete, it is especially important to know the weak points of these networks and find solutions to increase their security.

Here are some security methods that use in wireless networks:

  • WEP: Wired Equivalent Privacy: In this method, which is suitable for small networks, it blocks users who do not have permission in the network.
  • SSID: Service Set Identifier: These identifiers are placed in several Access Points and each user must configure the corresponding SSID identifier.
  • MAC: Media Access Control: In this method, only the computers whose MAC address has already been saved and are part of the list are allowed to access. This method is exceedingly difficult for large networks because all addresses must be stored.

The weakness of wireless networks:

One of the biggest disadvantages of these networks is the borderless coverage of the network structure, which means that vandals can receive its signals near this network and in case of breaking the not so strong security barriers of these networks, they can pretend to be a member of these networks. bring and have the possibility of obtaining vital information and destruction.

Ways to increase the security of systems

  • Check that the operating system and installed programs are up to date
  • Checking settings and detecting vulnerabilities
  • Installing anti-virus programs
  • Encoding data and files
  • Control user access to files, for example, edit and delete only specific users, and all users have read-only access.

What are benefit of using Firewall:

  • We can manage and control policies and services separately
  • Selection of input and output services to the network
  • Security control and user access management
  • Protecting and preventing those who intend to infiltrate the internal network
we can divide Firewalls into several categories:
  1. Circuit-level firewalls: this group disconnects the network connection with the computer behind them and takes the initial response instead of that computer, and if they are satisfied with the security of the connection, then they allow the data to go to the computer. flow This type has good speed because they do not check any data inside the packets
  2. Proxy server firewalls: In this type, information packets are checked in the application layer, and it provides high security by preventing the direct connection of the program with the servers, but this level of checking can lead to the slowness of these firewalls.
  3. No stateful packet filters: These filters allow packets to pass or block them in network layer protocols such as IP or in transport layer protocols such as TCP and UDP headers in the path of a network with a set of rules.
  4. Stateful Packet filters: These filters are much smarter and block all incoming traffic. They create connection records at the transport layer and are the basis of firewall implementation in modern networks. They store source and destination TCP and UDP port numbers, TCP sequence numbers and TCP flags, and can detect application layer protocols such as FTP and HTTP.
  5. Personal firewalls: Personal firewalls are installed on personal computers and are designed to deal with network attacks. The suggestion of installing on personal computers is extremely high

You can find other learning for Network Security by clicking here.