top of page
  • Pinterest
  • Facebook
  • Instagram

Formatting + Final mark

  • Writer: Lim Long Teck
    Lim Long Teck
  • May 11, 2021
  • 1 min read

Updated: Jun 24, 2021

Write a program to input student id, the marks for common test, assignment and continuous assessment and display the results in a format.


Program:

number = int(input('Enter student number: '))

ct = int(input('Enter common test mark: '))

a = int(input('Enter assessment mark: '))

ca = float(input('Enter continuous assessment mark: '))

final = ct*30/100 + a*30/100 + ca*40/100

print('{:13s}{:8s}{:10s}{:8s}{:5s}'.format('StudentNo','Test','Assign','CA','Final'))

print('{:<13d}{:<8d}{:<10d}{:<8.2f}{:<5.2f}'.format(number,ct,a,ca,final))


Output:

Enter student number: 1101

Enter common test mark: 80

Enter assessment mark: 70

Enter continuous assessment mark: 45

StudentNo Test Assign CA Final

1101 80 70 45.00 63.00


Recent Posts

See All
CountLetters

Write a Python program to - Prompt user to input a sentence - Count the occurrence of each letter in the input sentence - Save the result...

 
 
 
BirthdayParadox

The Birthday Paradox asks the question, “If you asked random people their birthday, how many people do you expect to ask before you find...

 
 
 
ChristmasTree

Write a program to prompt the user for a character and a number, and then print a Christmas tree accordingly. Program: char =...

 
 
 

Comments


bottom of page