You are on page 1of 2

NAME: CHAKKILAM TARUN SIDDARDHA

REGISTRATION NUMBER: 21MIC7027

ASSIGNMENT-1
SWE1004-INTRODUCTION TO PROGRAMMING IN PYTHON

1) Write a Python program to display the current date and time. 

CODE:
import datetime
now_time = datetime.datetime.now()
print(f"Current date & time are : {now_time}")
OUTPUT:

2) Write a Python program to get the Python version you are using

CODE:
import sys
version = sys.version
print("Version of python that you are using is " , version)

OUTPUT:

3) Write a Python program that accepts an integer (n) and computes the
value of n+nn+nnn 
CODE:
n = int(input("Enter an integer: "))
sum = n + n*n + n*n*n
print("Sum = ",sum)
OUTPUT:
4) Write a Python program to read and print various types of variables.

CODE:
a = 2
b = 2.9
c = "Python"
d = 1 + 2j
print(type(a))
print(type(b))
print(type(c))
print(type(d))

OUTPUT:

5) Write a Python program to print the calendar of a given month and year. 
 
CODE:
import calendar
year = int(input("Please enter the YEAR: "))
month = int(input("Please enter the MONTH: "))
print( calendar.month(year,month))

OUTPUT:

You might also like