Follow

iklan banner
MASIGNCLEAN101

Python TYBBA (CA) Pratical Slip 13 Savitribai Phule Pune University

Python TYBBA (CA) Pratical Slip 13 Savitribai Phule Pune University
Mr PVK
March 26, 2025

 Slip 13


A) Write a Python program to input a positive integer. Display correct message for correct and incorrect input. (Use Exception Handling)


try:

    num=int(input('Enter a number :'))

except ValueError:

    print("\nThis is not a number!")

else:

    print('\nnumber is : ',num)



Program Output :


Enter a number :BBA CA

This is not a number!






B) Write a program to implement the concept of queue using list. 


q=[ ]

q.append(10)

q.append(100)

q.append(1000)

q.append(10000)

print("InitialQueueis = ",q)

print(q.pop(0))

print(q.pop(0))

print(q.pop(0))

print("After Removing Elements : ",q)



Program Output :


 InitialQueueis = [10, 100, 1000, 10000]

10

100

1000

After Removing Elements : [10000]



 

Share This :
Mr PVK
Write Your Response
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
-_-
(o)
[-(
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
(c)
cheer
(li)
(pl)