NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing using Python
Week 2: Programming Assignment 1 - Hello World!
Write a program to accept a name as input and print “Hello <input name> ! Welcome to JOCP” as the output.
Note: input() method is used to accept user input in Python.
Input Format:
Single line of input contains a name
Output Format:
Display the expected string (No newline after the output)
Example:
Input:
Ram
Output:
Hello Ram ! Welcome to JOCP
(Please note that there is a space before and after the ! symbol)
Week 2: Programming Assignment 2 - Square of a number
Write a program to accept a number as input and display the square of the number as the output.
Note: int(input()) can be used to accept user input as an integer in Python.
Input Format:
The first line contains a user input number
Output Format:
Print the square of the number
Example:
Input:
5
Output:
25
Week 2: Programming Assignment 3 - Discount
A newly opened store is offering a 15% discount on the MRP value of any product.
Write a program that takes the value of a product in rupees as input and outputs the price after discount.
Input Format:
The first line contains a user input number
Output Format:
Print the value after discount as the output
Example:
Input:
100
Output:
85.0