Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Programme Name:BCS

Course Code: CSC 3530


Course Name: Advanced programming
Assignment. 1st
Date of Submission: 12/2/2020

Submitted By: Submitted To:

Student Name:Sanjeev gyawali Faculty Name:Amar Subedi

IUKL ID:041802900038 Department: computer science

Semester:4th

Intake:sept 2018
Question no 1
Code:-
from datetime import datetime
name=input("Enter you name:")
age=int(input("Enter age:"))
fyear=int((100-age) + datetime.now().year)
print(fyear)
print ('Hello %s. You are %s years old. You will turn 100 years old in
%s.' %(name,age,fyear))

Output:-

Question no 2
Code:-
print("Twinkle, twinkle, little star,\n \tHow I wonder what you are!\n
\t\tUp above the world so high,\n \t\tLike a diamond in the sky.\n Tw
inkle, twinkle, little star,\n How I wonder what you are")

Output:-
Question no 3
Code:-
import random
a=int(input("Enter your guess:"))
b=random.randint(1,9)
if a==b:
print("Well!guess")
else:
print("your guess is not right")

Question 4
Code:-
dec = int(input("Enter a decimal number: "))

print(bin(dec),"in binary.")
print(oct(dec),"in octal.")
print(hex(dec),"in hexadecimal.")
Output:-

You might also like