Skip to main content

CREATE NEW PYTHON FILE .PY AND RUN IT


CREATE NEW PYTHON FILE .PY AND RUN IT

Until now, we learned how to use python IDLE and make it interactive with user by understanding the concept of storing variables, taking input from user, type casting the input and few other data types’ concept. In this video I am going to explain how to create a new python .py file and run it. A bunch of code performing a certain task is to be written in python file. In this video, I have explained a basic code where two inputs are taken from the user and Arithmetic operations are performed respectively. The input taken from the user is type casted into an integer and used.
Once you are done with the code, save the code and click on run or press F5 to run the program. If there is any error, you will get an error message else the code will run perfectly.



Comments

Popular posts from this blog

NUMBERS AND OPERATORS

NUMBERS AND OPERATORS Numbers are normal operand values which are used to perform set of task or operations using an operator. Numbers can be integers, decimal value, etc. There are many operators in Python. Some of them are listed below: Ø Arithmetic operators Ø Comparison operators Ø Logical operators Ø Bitwise operators Ø Assignment operators In this blog we will see about Arithmetic operators and understand how to use it with Python IDLE to perform certain calculations. PYTHON ARITHMETIC OPERATORS OPERATOR DESCRIPTION EXAMPLE Addition (+) Adds two values 5+6 = 11 Subtraction (-) Subtracts 5-3 = 2 Multiplication (*) Multiplies two values 4*8 = 32 Division (/) Divide by right hand operand 6/3 = 2 Modulus (%) Divides and gives the remainder 6%3 = 0 Exponential (**) Performs power calculations on operand 2**4 = 32 Dou...

DECISION MAKING STATEMENTS

DECISION MAKING STATEMENTS During the execution of the program, when there is a specific application to check the condition and make a proper decision, Decision making statements are used to anticipate specific actions which has to be taken depending upon the condition. Decision making statements are evaluated using TRUE and FALSE values. For example, if a particular condition is TRUE what outcome is expected and when, FALSE what outcome is expected. Depending on the application of program, set of statements are written into the code to perform a particular task. Python provides following types of decision making statements: Ø If statement: It is normal If statement which has condition in terms of Boolean expression, comparison operators, etc. Ø If..else statement: In this case, an If is followed by an else statement. It means ‘IF’ condition turns to be FALSE than ‘ELSE’ will be executed automatically Ø Ladder If.. else if .. else if: This is an extension o...

INPUT FROM USER AND STORE IT IN VARIABLE

INPUT FROM USER AND STORE IT IN VARIABLE We have discussed in the earlier videos and blogs regarding variables and multiple assignments. Now let’s move on with taking real time inputs from user and storing it in a variable. Name = input(“Enter the Name : ”) This function is used to ask real time data from users and store it in the variable defined as Name. This function takes the value in string. This means when you give input as a numeric value, it also considers it as a string input and you can access it as I have explained in the video. To consider this string as numeric value or integer, we need to type cast the taken input as shown. Age = int(input(“Enter your age :”)) This function will type cast your string into an integer value. Type Casting:   In simple words, it means conversion of data type. To make use of programming approach in day to day life, conversion of data type is very useful. As explained earlier input() function considers the value in stri...