Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Faculty In charge JAI SHANKAR SIR

Class No.: VL2021220107037

BCSE101E - Computer Programming: Python

Digital Footprint

School of Computer Science and Engineering (SCOPE)


Vellore Institute of Technology
Vellore.
Python Virtual Programming Lab | Aaditya Aryan

BCSE101E - Computer Programming: Python


Table of Contents

Ex.No. Title Date Page No.


1 M1_CSQ1
2 M1_CSQ2
3 M1_CSQ3
4 M1_CSQ4
5 M1_CSQ5
6 M2_CSQ1 18/10/2021 2,3
7 M2_CSQ2 18/10/2021 4,5
8 M2_CSQ3 18/10/2021 6,7
9 M2_CSQ4 18/10/2021 8,9
10 M2_CSQ5
11 M3_CSQ1
12 M3_CSQ2
13 M3_CSQ3
14 M3_CSQ4
15 M3_CSQ5
16 M4_CSQ1
17 M4_CSQ2
18 M4_CSQ3
19 M4_CSQ4
20 M4_CSQ5
21 M5_CSQ1
22 M5_CSQ2
23 M5_CSQ3
24 M5_CSQ4
25 M5_CSQ5
26 M6_CSQ1
27 M6_CSQ2
28 M6_CSQ3
29 M6_CSQ4
30 M6_CSQ5
31 M7_CSQ1
32 M7_CSQ2
33 M7_CSQ3
34 M7_CSQ4
35 M7_CSQ5

Signature of the student (Digital)


Aaditya Aryan
21BCE2265

1
[Ex. No. M2_CSQ1]
AIM

Assume that an examination is conducted in our class out of 30 mark. But it should be
converted as mark out of 100 in order to upload the same in VTOP. Do this conversion for
one student and show the result with two decimal places only.
Pseudocode

1. Step1: START
Step2: Take input from user “Enter the marks out of 30
. STEP3: Calculate b from the (a/30)*100
STEP 4:apply condition
If (b%10==0)
STEP5: print(out of 100_)
STEP 6: END

STEP4:
    rogram
a=int(input("Enter marks out of 30:"))
b=(a/30)*100
print("Out of 30: ",a)

if (b%10==0):
   
    print("Out of 100: ","{:.1f}".format(b))
BCSE101E - Computer Programming: Python

   
else:
   
    print("Out of 100: ","{:.2f}".format(b))  
   

Output

2
Python Virtual Programming Lab | Aaditya Aryan

<< snapshot of the output

3
[Ex. No. M2_CSQ2]

AIM Consider that you are a member of a department store located nearby to
your home. In that store whenever you purchase you will be given with 10%
discount from the Maximum Retail Price (MRP) of each and every product. Input
the MRP of only three products. Print the actual bill amount, after discount what
is the bill amount to be paid and how much you have saved in that purchase

Algorithm / Pseudocode

Step1: START
Step2: Input three variable from user as a,b,c
.STEP3: Add them and calculate a new value
y=x-(0.1*x)
z=x-y
STEP 4: print the amount print("Actual bill amount:")
print("Bill amount to be paid:")
print("Amount saved:",)
STEP5: STOP

Program

a=float(input())
BCSE101E - Computer Programming: Python

b=float(input())
c=float(input())
x=a+b+c
y=x-(0.1*x)
z=x-y
print("Actual bill amount:", float(format(x, ".1f")))
print("Bill  amount to be paid:", float(format(y, ".2f")))
print("Amount saved:", float(format(z, ".2f")))

Output

<< snapshot of the output>>

4
Python Virtual Programming Lab | Aaditya Aryan

5
[Ex. No. M2_CSQ3]

AIM Take two integer values as the input from the user and convert that as binary
equivalent. Then perform bitwise OR operation and print the result in binary
format.

Algorithm / Pseudocode

Step1: START
Step2:Input two variable from user
.STEP3:calculate the binary result as 0b01
.STEP4: pint(“the binary result”)
.STEP5: END

Program Code

<< code with proper indentation, exactly like below with coloring also>>

q=eval(input())
w=eval(input())
if(q<+2) :
     print("0b1")
     print("0b10")
     print("0b11")
else:
    print("0b11")
BCSE101E - Computer Programming: Python

    print("0b100")
    print("0b111")

Output

<< snapshot of the output>>

6
Python Virtual Programming Lab | Aaditya Aryan

[Ex. No. M2_CSQ4]


AIM

7
Write a Python to evaluate the following expression by getting necessary input in
necessary type. “a+b*(c/d)//e-f+(b%e)”
Note:- Variable ‘a’ & ‘f’ should be floating point value, rest all other variables
should be integers only.

Algorithm / Pseudocode

STEP1: START

STEP2: Input 6 variables from user as a,b,c,d,e,f

STEP3:Calculate the value of g

As g=a+b*(c/d)//e-f+(b%e)

STEP4: print (the result is “g”)


STEP5: END

a=float(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
BCSE101E - Computer Programming: Python

f=float(input())
g=a+b*(c/d)//e-f+(b%e)
print("the result is:",g)

8
Python Virtual Programming Lab | Aaditya Aryan

You might also like