Page 100 - TP_Play_V2.1_class6
P. 100
Running a Python Program Tech Funda
Follow these steps to run a Python
program: Press F5 key to run a program in Python.
Step 1 Click on Run in the Menu bar.
Step 2 Click on Run Module option.
Running a program
The program will execute and the output will be shown in the Shell window.
Output
Clickipedia
Interactive Mode is very useful for testing a code as it displays the errors one by one.
INPUT AND OUTPUT
Python provides two commonly used functions input() and print() for input and output.
The input() Function
The input() function takes the user’s input while a program executes. The general syntax of the
input() function is as follows:
input(<prompt>)
Here, prompt is the string or message we wish to display on the screen. Example:
name = input("Enter your name: ")
>>> Enter your name: "Mohan"
The name 'Mohan' entered by the user will be stored in variable 'name'.
By default, Python considers the input as string even if you entered a number as input. You
cannot perform calculations on string. To perform calculations, you need to convert the string
into integer or floating-point value. To do so, Python provides following functions:
int(): It is used to change the input data value into integer. For example,
a = int(input("Enter a number "))
98 Play (Ver. 2.1)-VI

