Introduction to text-based programming using Replit.com, concept of print, input, strings & variables & creating games in python
What is python?
Python is a computer programming language which is easy to learn and readable. It was created by ‘Guido Van Rossum’ and released in 1991.
Python lets you work quickly and integrate systems more effectively. Python is a computer programming language often used to build websites and software, games, automate tasks, and conduct data analysis.
Python is a high-level programming language. Python interpreted, interactive and object-oriented scripting language.
2. Free and open source: Python is free and open source. You can download it from python website. Since, it is open source , this means that source code is also available to the public.
3. Portable: Python language is also a portable language. For example, if we have Python code for windows and if we want to run this code on other platforms such as Linux, Unix, and Mac then we do not need to change it, we can run this code on any platform.
4. Object-Oriented Language: In Python, object-oriented Programming (OOPs) is a programming paradigm that uses objects and classes in programming. It aims to implement real-world entities like inheritance, polymorphisms, encapsulation, etc. in the programming. The main concept of OOPs is to bind the data and the functions that work on that together as a single unit so that no other part of the code can access this data.
4. High-level Language: Python is a high-level language. When we write programs in Python, we do not need to remember the system architecture, nor do we need to manage the memory.
Replit: Replit is a free IDE(Integrated development environment) that allows users to write their own programs in different languages.
Step 1: Open the link https://replit.com/~ and click on “Log in”.
Step 2: Sign in by using your existing gmail account or by creating a new account.
Step 3: Now click on “Continue with Google”.
Step 4: Click on the “Create” and choose “Python”.
Step 5: Now, Click on the “Create Repl” button.
What is print() function in python?
Python() command is used to print the message on the screen.
In other words, Python() function is used to print the text in single line.
What is input() function in python?
In Python, we use input() function to take input from the user. Whatever you enter as input, the input function converts it into a string. If you enter an integer value still input() function convert it into a string.
What is String in python?
In python, String is a collection of words, letters, alphabets and other characters. Strings can be created by enclosing characters inside a single quote(‘ ‘) or double quotes(“ “). Python strings are “immutable” which means they cannot be changed after they are created. Since strings can’t be changed, we construct *new* strings as we go to represent computed values. So for example the expression (‘hello’ + ‘there’) takes in the 2 strings ‘hello’ and ‘there’ and builds a new string ‘hellothere’.
What are Variables in python?
Variables are containers that are used to store the data values. Variables are used to store data, they take memory space based on the type of value we assigning to them.
In other words, a variable in a python program gives data to the computer for processing.
Example: x = 100 So, Here ‘X’ is a variable which is storing the value 100 in it.