Professional Documents
Culture Documents
21bce2265 Module 2.dox
21bce2265 Module 2.dox
Digital Footprint
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
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
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
6
Python Virtual Programming Lab | Aaditya Aryan
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
As g=a+b*(c/d)//e-f+(b%e)
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