0% found this document useful (0 votes)
10 views

sumit_python-set-3 (2)

This document contains a series of Python practical exercises focusing on various programming tasks. The exercises include calculating angles, powers, sine and cosine values, determining change for coins, and drawing modular rectangles. Each practical task is designed to enhance programming skills and understanding of basic Python functions and control structures.

Uploaded by

studant103
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

sumit_python-set-3 (2)

This document contains a series of Python practical exercises focusing on various programming tasks. The exercises include calculating angles, powers, sine and cosine values, determining change for coins, and drawing modular rectangles. Each practical task is designed to enhance programming skills and understanding of basic Python functions and control structures.

Uploaded by

studant103
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Practical set - 3

Practical – 3.1

Degree = int(input('Enter the angle between -180 to 180 :')) if


(Degree<0):

print(360+Degree)
else: print(Degree)

Practical -3.2

value = int(input('enter the value : '))


value = value %10 power =
int(input('enter the power : '))
print('ans :',value**power)

Practical - 3.3

value = int(input('enter the value : '))


digit = int(input('enter the digit : '))
Raval sumit 22291371125
Python Practical set - 3

value = value %(10**digit) power =


int(input('enter the power : '))
print('ans :',value**power)

Practical -3.4

#Write a program that prints out the sine and cosine of the
angles ranging from 0 to 345b&
#in 15 increments. Each result should be rounded to 4
decimal places. Sample output is shown #below:

from math import sin, cos, pi for


number in range (0, 346, 15):

print (number, '---', round(sin(number*pi/180),4), '\


t',round(cos(number*pi/180),4))

Practical - 3.5

C = int(input('enter the century in two digit : '))


Y = int(input('enter the year in four digit : ')) m
= (15+C-(C/4)-((8*C-13)/25))%30 n =

Raval sumit 22291371125


Python Practical set - 3

(4+C-(C/4))%7 a = Y %4 b = Y %7 c = Y %19 d =
(19*c +m)%30 e = (2*a + 4*b + 6*d + n)%7

Practical – 3.6

#Write a program that given an amount of change less than


$1.00 will print out exactly how
#many quarters, dimes, nickels, and pennies will be needed
to efficiently make that change.
#[Hint: the // operator may be useful.]

x = 1.27
(y, z) = divmod (x, 0.50)
(p, q) = divmod (z, 0.25) (a,
b) = divmod (q, 0.01)

print ('Half coin:', y, 'quarter coin:', p, 'paisa coin:', a)


Practical 7

#''' Write a program that draws bmodular rectanglesb like the


ones below. The user specifies the

Raval sumit 22291371125


Python Practical set - 3

#width and height of the rectangle, and the entries start at 0


and increase typewriter fashion
#from left to right and top to bottom, but are all done mod
10. Below are examples of a 3 C5
#rectangle and a 4 C 8 .'''

row = int (input ('enter the row : '))


col = int (input ('enter the col : ')) x
= 0 for i in range (row): for j in
range (col):

print (x % 10, end = ' ')


x += 1 print ('\n')

Raval sumit 22291371125

You might also like