Assignment
University
American Baptist CollegeCourse
BU 100L | Basic Computer SciencePages
9
Academic year
2023
Avaiya Priyank
Views
0
20SE02IT009 HARSH BHANDERI ASSINGMENT – 2 Q1 Program to print string in specific format print("Twincle, tiwncle little start\n\tHow i wnder what you are\n\t\tUp above the world so high,\n\t\tLike a diamond in the sky.\nTwincle,twincle little star\n\tHow I wonder what you are")
Q2 Fill the blank for output >>> color="Yellow" >>> thing="sunshine" >>> print(color + " is the color of "+ thing) Yellow is the color of sunshine `
Q3 Convert integer into different format. x=int(input("Input ineger number:\t")) print("Binary: " + bin(x)) print("Hexadecimal: " + hex(x)) print("Octal: " + oct(x)) VICEVERSA:- x=(input("input binary number:\t")) print(int(x,2))
Q4 Calculation of complex number x = 4+6j y=5+8j add = x+y sub = x-y mul = x*y div = x/y print("Additio n of number is:", add) print("Substra ction of number is:", sub) print("Multipli cation of number is:", mul) print("Division
of number is:", div) Q5 Calculate area of circle x=float(input("Enter radius R: ")) print("Area = ", x*x*3.14 )
Q6 GOLDEN RATIO
Q7 second in week >>> x=86400 >>> print("Second in week", 7*x)
Q8 PASSWORD POSSIBILITY >>> print("Possible number of password using 6 alphabet is ", 26**6) Possible number of password using 6 alphabet is 308915776 Q9 Sector in disk
print("Disk size is 16GB") print("16GB is equal to 1073741824 bytes") print("one sector is equal to 512 bytes") x = int(1073741824/512) print("Our drive will be divided into", x , "parts")
Assignment 2
Please or to post comments