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

Doc1

The document contains several Python code snippets demonstrating various functionalities. It includes conversions between Celsius and Fahrenheit, checks for vowels or consonants, determines the type of triangle based on side lengths, finds numbers divisible by 7 and multiples of 5 within a range, and sums two integers with a specific condition. Each code segment is designed to illustrate a different programming concept or problem-solving approach.

Uploaded by

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

Doc1

The document contains several Python code snippets demonstrating various functionalities. It includes conversions between Celsius and Fahrenheit, checks for vowels or consonants, determines the type of triangle based on side lengths, finds numbers divisible by 7 and multiples of 5 within a range, and sums two integers with a specific condition. Each code segment is designed to illustrate a different programming concept or problem-solving approach.

Uploaded by

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

1. fahrenheit = (celsius * 1.

8) + 32

print('%.2f Celsius is equivalent to: %.2f Fahrenheit'


% (celsius, fahrenheit))

2. def vowelOrConsonant(x):

if (x == 'a' or x == 'e' or
x == 'i' or x == 'o' or x == 'u'):
print("Vowel")
else:
print("Consonant")

vowelOrConsonant('c')
vowelOrConsonant('e')

3. def checkTriangle(x, y, z):

\
if x == y == z:
print("Equilateral Triangle")

elif x == y or y == z or z == x:
print("Isosceles Triangle")

else:
print("Scalene Triangle")
x=8
y=7
z=9
checkTriangle(x, y, z)

4. (Write a Python program to find those numbers which are divisible by 7 andmultiple of 5,
between 1500 and 2700 (both included))

5. import math

minimum = 100
maximum = 200

min_multiple = math.ceil(minimum / 35) * 35


max_multiple = math.floor(maximum / 35) * 35
result = range(min_multiple, max_multiple+1, 35)

if result:
print(*result, sep='\n')
else:
print("No numbers found.")

(Write a Python program to sum of two given integers. However, if the sumis between 15 to 20 it will return 20.)

5. def sum(x, y):


sum = x + y
if sum in range(15, 20):
return 20
else:
return sum

print(sum(10, 6))
print(sum(10, 2))
print(sum(10, 12))

You might also like