Posts

Python_Casting

Python_Casting Casting is when you convert a variable value from one type another . This is done in python. The functions are int(),float(),str() Example: Integers (int) type x = int ( 1 ) y = int ( 2.8 ) z = int ( "3" ) print (x) print (y) print (z) Output: The o/p of program is ‘int’ type 1 2 3 Example: Float type x = float(1) y = float(2.8) z = float("3") w = float("4.2") print(x) print(y) print(z) print(w) Output: The o/p of program is ‘float’ type 1.0 2.8 3.0 4.2 Example: String type x = str ( "Vedanta" ) y = str ( 8 ) z = str ( 5.0 ) print (x) print (y) print (z) Output: The o/p of program is ‘str’ type Vedanta 8 5.0

Python_Numbers

Python _Numbers   Generally there are three numeric types in Python.      1.    int      2.    float      3.    complex Example 1: x = 10 y = 5.5 z = 5j print ( type (x)) print ( type (y)) print ( type (z)) Output: <class 'int'> <class 'float'> <class 'complex'> To verify which type of object, type() function Int type Integer represents the whole numbers, positive or negative numbers, but it cannot show  decimal numbers. x = 55 y = 3525646465 z = - 3 print ( type (x)) print ( type (y)) print ( type (z)) Output: <class 'int'> <class 'int'> <class 'int'> The type of object is ‘int’ type. Float type It represents the positive or negative numbers, that contains  decimal values. x = 5.10 y = 10.0 z = - 45.60 print ( type (x)) print ( type (y)) print ( type (z)) <class 'float'> ...

Python_Variable

example:1 x = 15 x = "Roman" print(x) Variable cannot start with a number so  the output of this program is ‘Roman’ A variable name must start with a letter or the underscore character. A variable name cannot start with a number. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _). Variable names are case-sensitive (abc, Abc and ABC are three different variables). The most important things is, it is case sensitive. example:2 x = "Roman " y = "is a Boy" z =  x + y print(z) Output: Roman is a Boy in this case,'+' character used for adding one variable to another variable. example:3 x = 2 y = 5 print(x + y) Output: 7  '+' character used as mathmatical operator. Example:4 x = 56 #int type y = "Roman" #string type print(x + y) Output: Error one is 'int' type another is 'string' type ,we cann...

Python_Programming

What is Python? Python is a popular programming language. It was created by Guido van Rossum, and released in 1991. It is used for: web development (server-side), software development, mathematics, system scripting. What can Python do? Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development. Why Python? Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). Python has a simple syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed...