The document contains code snippets for 6 programming tasks: 1) calculating commission based on monthly sales, 2) finding the absolute value of a number, 3) determining the state of water based on temperature, 4) calculating the average of 5 subject marks, 5) finding the largest of 3 numbers, and 6) printing odd numbers not divisible by 3 between 1 and 100.
The document contains code snippets for 6 programming tasks: 1) calculating commission based on monthly sales, 2) finding the absolute value of a number, 3) determining the state of water based on temperature, 4) calculating the average of 5 subject marks, 5) finding the largest of 3 numbers, and 6) printing odd numbers not divisible by 3 between 1 and 100.
The document contains code snippets for 6 programming tasks: 1) calculating commission based on monthly sales, 2) finding the absolute value of a number, 3) determining the state of water based on temperature, 4) calculating the average of 5 subject marks, 5) finding the largest of 3 numbers, and 6) printing odd numbers not divisible by 3 between 1 and 100.
if number < 0: absolute = -number else: absolute = number print("The absolute value is : “,absolute)
3. temp = float(input("Enter the water temperature in Celsius: "))
if temp <= 0: state = "Solid state." elif 0 < temp < 100: state = "Liquid state." else: state = "Gaseous state." print("The water is in ",state)
4. m1 = int(input("Enter marks for subject 1: "))
m2 = int(input("Enter marks for subject 2: ")) m3 = int(input("Enter marks for subject 3: ")) m4 = int(input("Enter marks for subject 4: ")) m5 = int(input("Enter marks for subject 5: ")) avg = (m1 + m2 + m3 + m4 + m5) / 5 print("The average marks for the 5 subjects is: ", avg) 5. num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) num3 = int(input("Enter the third number: ")) if num1 >= num2 and num1 >= num3: largest = num1 elif num2 >= num1 and num2 >= num3: largest = num2 else: largest = num3 print("The largest number is: ",largest)