IX PYTHON PRACTICAL FILE
IX PYTHON PRACTICAL FILE
Output:
Enter any number 6
The square value of n is 36
Output:
Enter first number 4
Enter second number 2
The Sum is 6
The Multiply is 8
The Division is 2.0
The floor division is 2
The remainder is 0
The power is 16
Output:
No of Terms 6
6x1=6
6 x 2 = 12
6 x 3 = 18
6 x 4 = 24
6 x 5 = 30
Output:
Principal Amount 50000
Duration 3
Interest Rate 3
Total interest you have to pay: 4500.0
Output:
Enter distance in kilometer: 12
12.000 Kilometer = 12000.000 Meter
Output:
Length : 8
Width : 5
Area of the Rectangle: 40
Perimeter of the Rectangle : 26
Output:
Please Enter the Base of a Triangle: 7
Please Enter the Height of a Triangle: 6
The Area of a Triangle using 7.0 and 6.0 = 21.0
Output:
Enter the marks of five subjects:
Enter subject1 Mark 89
Enter subject2 Mark 87
Enter subject3 Mark 76
Enter subject4 Mark 98
Enter subject5 Mark 90
The Total marks is: 440 / 500.00
The Average marks is: 88.0
The Percentage is: 88.0 %
The Grade is: B
Output:
Enter first number: 8
Enter second number: 9
Enter third number: 10
The largest number is 10.0
Output:
Enter a number: 8
Positive number
Enter a number: -7
Negative number
Output:
Enter a number: 5
The factorial of 5 is 120
# Split the string into three separate strings, each containing only a word
print("Split the words of the string: %s" % s.split(" "))
Output:
Length of s = 20
The first occurrence of the letter a = 8
a occurs 2 times
The first five characters are 'Strin'
The next five characters are 'gs ar'
The thirteenth character is 'a'
The characters with odd index are 'tig r wsm!'
The last five characters are 'some!'
String in uppercase: STRINGS ARE AWESOME!
String in lowercase: strings are awesome!
welcome to python
welcome to python
Split the words of the string: ['welcome', 'to', 'python']
list3=["one",8,10,"three"]
list4=["two","five",3.5,2]
list3.extend(list4) #Extend the list
print(list1)
print(max(list1)
print(max(list1)
Output: