Python WS 1.1
Python WS 1.1
Engineering
LAB FILE
Experiment – 1.1
Aim: Writing python programs in various modes and printing and assigning values
assigned to the variables.
Program 1.1.1:
Write a program to enter two numbers and perform all arithmetic operations.
Program Code:
num1=eval(input("Enter first number "));\
... num2=eval(input("Enter second number "));\
... print("The arithmetic operations are as follows :");\
... print("Addition :", num1+num2);\
... print("Subtraction : ", num1-num2);\
... print("Multiplication : ", num1*num2);\
... print("Division : ",num1/num2);\
... print("Modulus : ", num1%num2);\
... print("Floor : ", num1//num2);\
... print("Exponent : ", num1**num2);
Output:
Program 1.1.2:
Write a program to enter marks of five subjects and calculate total, average and percentage.
Program Code:
Program 1.1.3:
Write a program to enter length in centimeter and convert it into meter and kilometer, and also
convert the same into equivalents.
Program Code:
Output:
Table of Contents
UNIT-I
II. Program to demonstrate the use of if, if-else, while, for, break and continue.
IV. Program to demonstrate the various kind of operations that can be applied
to the string.
X Program to demonstrate read and write data to the file in various modes.
INDEX