Program.py - PYTHON - Visual Studio Code
Sem3 Sem4 Sem5 Sem6 Sem7 Sem8

EXPLORER

...

VS_CODE
PYTHON

program1.py

program2.py

program3.py

program4.py

program5.py

program6.py

program7.py

program8.py

program9.py

program10.py

part_B.py

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

Program 1

X

        # program 1

# 1. a.
m1 = int(input("Enter the marks in the first test: "))

m2 = int(input("Enter the marks in second test: "))
    
m3 = int(input("Enter the marks in third test: "))
    
if m1 > m2:
    if m2 > m3:
      total = m1 + m2
    else:
     total = m1 + m3
else:
  if m1 > m3:
    total = m1 + m2
  else:
    total = m2 + m3

Avg = total / 2

print("The average of the best two test marks is: ", Avg)

# 1.b.
num = int(input("Enter a number:"))
temp = num
rev = 0

while num != 0:
  dig = num % 10
  rev = rev * 10 + dig
  num = num // 10

if temp == rev:
  print("The number is palindrome!")
else:
  print("Not a palindrome!")

print("The Occurance of each digit in:", temp)

message = str(temp)
count = {}

for character in message:
  count.setdefault(character, 0)
  count[character] += 1

print(count)