Skip to main content

Posts

Showing posts from April 17, 2021

Python Variables

variables,the name itself implies that a variable is something which can change.  Variables are like containers for storing  our data values in memory. we can change the data in variables, in python everything is an object and variables are like names given to the object, by labeling them we can easily access them. In other high level languages like C programming language, c++ programming language, and java programming language. etc.,   we need to declare the datatype of the variable , but in python it will automatically recognize the type of data you are storing in a variable. ** Remember that a variable is a name which is given to a value not to the memory. Declaring a variable is very easy you need to assign a value or a string using '=' operator. >>> p=9 >>> print(p) 9 Assigning a single value to multiple variables We can assign a single value to multiple variables.  >>> a=b=c=56 >>> a 56 >>> b 56 >>> c 56 Assigning diff

Even or Odd Number and Factorial of a Number in Python Programming

1. To Check if the given number is even or odd If a number is completely divided by 2 then it is even number. When the number is divided by 2, we use the remainder operator %  to calculate the remainder. If the remainder is not zero, the number is odd. SOURCE CODE:- n= int ( input ( "enter any number:- " )) if (n% 2 == 0 ): print (n , 'is even number' ) else : print (n , 'is odd number' ) OUTPUT 1st Run enter any number:- 2 2 is even number 2nd Run enter any number:- 3 3 is odd number In the above code we use "Simple if" statement.  In the above program, we ask the user for input and check if the number is odd or even. 2.Factorial number Factorial of a number defined as the product of all numbers from 1 to given number. For example  5!(5 factorial)=5*4*3*2*1 is 120. Note = factorial of 0 is 1 SOURCE CODE n= int ( input ( "Enter any number:- " )) fact= 1 for i in range ( 1 , n+ 1 ): fact=fact*i print ( 'factorial of' ,

Computer System Architecture

 Based on number of general purpose processors computer systems are classified into three types.They are: Single Processor Systems. Multiprocessor Systems. Clustered Systems. Single Processor Systems From the name it is very clear that it has only single processor. A major central processing unit that can execute a set of general utility instructions, including user process instructions. There are some other special purpose processors present that performs device specific task. In the single processor system apart from the main central processing unit(CPU) there are also other processors which are present which does not do the general purpose task but it performs some device specific task. It means that we have a certain devices in our computers like keyboard, disk, etc. for all this they may be some microprocessor  which is specified to do a specific task related to that device like for example keyboard, when we press a key on our keyboard the keystroke has to be converted to some kin

Contact form

Name

Email *

Message *