Docsity

Python questions also a sheet for exam, Cheat Sheet of Probability and Stochastic Processes

Toggle sidebar
bg1
LAB2 ||PYTHON
Q1.Enter 3 marks for Ali ,calculate Sum, finnaly print ali
marks=sum.
ali=[90,85,89]
print("marks")
marks_ali=ali[0]+ali[1]+ali[2]
print('marks after sum' , marks_ali)
.......................................................................................................
Q2.Prompt the user for 2 numbers also perform various
operations
a. num1 // num2.
b. num1 + num2.
c. num1 to the power 3.
num1=int(input('enter the 1st num'))
num2=int(input('enter the 2nd number'))
print("sum is" , num1 + num2)
print("devision is " , num1 // num2)
print("power 3" , num1 **3)
.......................................................................................................
Q3.Define a string S="computer" write code to print
c#o#m#p#u#t#e#r.
s="computer"
print(s[0].upper(),s[1],s[2].upper(),s[3],s[4].upper(),s[5],s[6].uppe
r(),s[7],sep='#')
pf2

Partial preview of the text

Download Python questions also a sheet for exam and more Cheat Sheet Probability and Stochastic Processes in PDF only on Docsity!

LAB2 ||PYTHON

Q1.Enter 3 marks for Ali ,calculate Sum, finnaly print ali marks=sum. ali=[90,85,89] print("marks") marks_ali=ali[0]+ali[1]+ali[2] print('marks after sum' , marks_ali) ....................................................................................................... Q2.Prompt the user for 2 numbers also perform various operations a. num1 // num2. b. num1 + num2. c. num1 to the power 3. num1=int(input('enter the 1st num')) num2=int(input('enter the 2nd number')) print("sum is" , num1 + num2) print("devision is " , num1 // num2) print("power 3" , num1 **3) ....................................................................................................... Q3.Define a string S="computer" write code to print c#o#m#p#u#t#e#r. s="computer" print(s[0].upper(),s[1],s[2].upper(),s[3],s[4].upper(),s[5],s[6].uppe r(),s[7],sep='#')