Python Tutorials, Tricks & Tips, Projects, etc..,

In this tutorial, you are going to learn about python input(), output() built-in functions. And also, you will learn how to import modules use them in programs. Python Input, Output Python has a large number of built-in functions. Most of them are mostly used in the programs. Now, we discuss about print() , input() and import functions. Let's start with input() function..... Python Input() function If you want to take the input from the user in python. You can use input() function. Let's see the syntax..... input([message]) input tells to take the input from the user and message is to display on the screen to the user. input() function takes the input from the user as a string. See the example..... >>> input('Enter a number:-') Enter a number:-2 '2' Python input() function takes the input as a string . To convert it into int just use the built-in function int() to convert. See the example..... >>> a = input('

Python Input, Output and Import Functions

No comments:

In this tutorial, you are going to learn about Python Data Types . Python has mainly 7 different data types. You will learn about all of them in this tutorial. Python Data Types You can find a lot of data types in Python. Every value in any Programming language is a data type. You can use the type() built-in function to check the type of a variable or a value in Python. See the example..... >>> type('geeksbro') <class 'str'> >>> type(7) <class 'int'> Let's see some mainly using data type in Python..... #1. Numbers Numbers are one of the most important data types in Python programming language. Python has three different type of built-in number types. They are int float complex Integers can be of any length in Python. They don't have any limits if the memory was available. See the example..... >>> integer = 12345 >>> integer.bit_length() 14 >>> integer = 12345677890 >>

Python Data Types | Complete Tutorial | Data Type Conversion

No comments:

In this tutorial, you are going to learn about Python Literals. What are Python Literals and different types of Python Literals. Python Literals are Boolean Literals, Number Literals, String Literals, Special Literal and Literal Collections. Python Literals Literals are the values given to a variable or constant. Python supports different type of Literals. Let's start..... #1. Boolean Literals A Boolean Literal can have any of the two values: True or False Program: boolean1 = (1 == True) boolean2 = (0 != False) x = False + 0 y = True + 2 print(true) print(false) print(x) print(y) Output: True False 0 3 In the above program, the value of boolean1 is True and the value of boolean2 is False . In Python True is equalled to 1 and False is equalled to 0 . You can also use Boolean literals in the Mathematical expressions. See the Statements 3 and 4 to get an Idea. The value of x is 0 and the value of y is 3 . Because the True == 1 and False == 0 . #

Python Literals | Different Types Of Literals in Python

No comments:

In this tutorial, you are going to learn about the Python Variables. Variables are the basic part of any programming Language. Python Variables Variables are the names used to refer to memory locations. Variables are also known as Identifiers . Variables are used to hold a Value. Variables names can be letters or the combination of digits and letters. But, their name must start with a letter or underscore . Declaring and Assigning Values to Variables In Python , you need not declare the type of variable while assigning a value to it. Python explicitly takes the value type. Python Variable value can be a digit, a character, a string or anything that is supported by the Python programming language. The equal sign ( = ) is used to assign a value to variables. See the examples..... >>> variable_name = 5 >>> my_variable = 'h' >>> my_name = 'geeksbro' In the above code we declare different variables and assign them different type

Python Variables | Declaring Variables In Python

No comments:

In this tutorial, you will learn about Pythons' Comment, statement and the importance of indentation in Python programming language. Python Comments Python Comments are the instructions that the interpreter doesn't execute. Comments are very important in the programming. They tell us, what a block of code does in the programs. It also helps if your working in a team. So, taking time to explain the code will help you in the future. Python Comments are best for the programmers to understand the code. SingleLine Comments In the Python programming language, we have single line comments which start with the # character. Program #python code to swap 2 numbers a = 5 b = 7 a, b = b, a print(a, b) Output 7 5 The line which starts with # is the comment. As you can see that the comment was ignored by the interpreter. MultiLine Comments In the Python Programming language, we have another type of comments called Multiline comments, which are enclosed in the triple

Python Comments, Statements and Indentation

No comments:

In this tutorial, You will Learn about Keywords (reserved words in python) and Identifiers (a name that is given to variables, functions, etc..,) Keywords and Identifiers plays a significant role in any Programming language. You have to know about them. Let's start..... Python Keywords Keywords are the reserved in Python. We can't use the keywords as a variable name or function name or any other identifier. They have their unique usage, which is to define the structure and syntax of Python programming language. Python is a case-sensitive programming language. Means the lowercase name and the UPPERCASE name are totally different. Example :- a is different from A There are 33 Keywords in the Python 3.6 Version as of now. Later in upcoming versions, count maybe increases or decreases. Keywords in Python Programming Language False None True and as assert break class continue def del elif else except finally for from global import

Keywords and Identifiers in Python Programming Language

No comments: