0% found this document useful (0 votes)
2 views2 pages

Ict Assignmment Python

The document contains a series of Python code snippets that perform various tasks, including comparing three numbers, calculating the area or circumference of a circle, performing division operations, calculating total income from principal and interest, adjusting salary based on grade, checking if a character is a vowel, and determining the type of a character. Each snippet prompts the user for input and provides output based on the calculations or conditions defined. The code demonstrates basic programming concepts such as conditional statements, user input, and functions.

Uploaded by

farhanjaffar12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Ict Assignmment Python

The document contains a series of Python code snippets that perform various tasks, including comparing three numbers, calculating the area or circumference of a circle, performing division operations, calculating total income from principal and interest, adjusting salary based on grade, checking if a character is a vowel, and determining the type of a character. Each snippet prompts the user for input and provides output based on the calculations or conditions defined. The code demonstrates basic programming concepts such as conditional statements, user input, and functions.

Uploaded by

farhanjaffar12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

n1= input("enter first number")

n2= input("enter second number")


n3= input("enter third number")
if n1>n2>n3:
print(n1)
elif n2>n1>n3:
print(n2)
else:
print(n3)

area= ("3.14 * r** 2")


circumference= ("2 * 3.14 * r")
number= eval(input("enter 1 for area or 2 for circumference"))
if number==1:
print(area)
elif number==2:
print(circumference)
else:
print("invalid input")

dividend= eval(input("enter dividend"))


divisor= eval(input("enter divisor"))

#calculations

quotient= dividend // divisor


remainder= dividend % divisor
print("the quotient is", quotient)
print("the remainder is", remainder)

p_amount = float(input("Enter principal amount: "))


interest = float(input("Enter rate of interest (e.g., for 5% write 5): "))
years = int(input("Enter number of years: "))
interest_rate = interest / 100 # Convert interest rate to decimal

# Total income calculation


total_income = p_amount * (1 + interest_rate * years)

print("Total income is:", total_income)

salary= eval(input("enter your salary"))


grade= eval(input("enter your grade"))
if grade> 15:
print("the salary is", salary * (1 + 0.5))
else:
print("the salary is ", salary * (1 + 0.25))

vowels = "aeiouAEIOU"

char = input("Enter a character: ")


if char in vowels:
print(char, "is a vowel")
else:
print(char, "is not a vowel")

def determine_character_type(char):
if char.isupper():
return "capital letter"
elif char.islower():
return "small letter"
elif char.isdigit():
return "digit"
else:
return "special symbol"

char = input("Enter a character: ")


character_type = determine_character_type(char)

print(f"The character '{char}' is a {character_type}.")

You might also like