Assignment-package
Do the programs in colab. Rename the note book file with youname-rollno.ipynb . Convert the file into pdf. Follow the link below to learn how to convert your ipynb file to pdf.
1.Read a number in decimal and convert it into different bases.
2.Read a binary number (Eg: 0b101010) and convert it into different bases.( use eval,oct,hex functions)
3.Find the number of digits in the factorial of a given number.(i/p rollno+1000)
4. What will be the result of the following expressions in Python?
6.Print a random number between 1 and 100 ( use random module)
7.Print the python version you are using ( use sys module)
8.Print the files in the current directory ( use os module)
https://saturncloud.io/blog/convert-google-colab-notebook-to-pdf-html/
share the pdf file in group
share the pdf file in group
1.Read a number in decimal and convert it into different bases.
2.Read a binary number (Eg: 0b101010) and convert it into different bases.( use eval,oct,hex functions)
3.Find the number of digits in the factorial of a given number.(i/p rollno+1000)
4. What will be the result of the following expressions in Python?
i) (50 %-4 - 5 * *6) // 4
ii) not (10 < 5) or (5 = = 5)
iii) True and 5
5.Read a Year and month and print the calendar of the specified month.( Use your date of birth and mention the day name you are born)6.Print a random number between 1 and 100 ( use random module)
7.Print the python version you are using ( use sys module)
8.Print the files in the current directory ( use os module)
9. Find the output of this ( Learn the functions)
import math
print(math.floor(3.999999999999))
print(math.ceil(-3.000000000001))
print(math.trunc(-3.9))
10.
import math
print(-10 % 3)
print(math.fmod(-10, 3))
11.
import time
print(time.localtime())
print(time.gmtime())
12. Compute execution time .
import time
start = time.time()
for i in range(1000000):
pass
end = time.time()
print(end - start)
13.Formatted printing of time. ( Print time in any other format you like)
import time
print(time.strftime("%Y-%d-%m %H:%M:%S")
14.Learn the statstics package. ( add your roll number in the data and find the results)
import statistics as stats
data = [10, 15, 20, 25, 30,20,20]
mean_value = stats.mean(data)
median_value = stats.median(data)
mode_value = stats.mode(data)
variance_value = stats.variance(data)
std_deviation = stats.stdev(data)
print("Data:", data)
print("Mean:", mean_value)
print("Median:", median_value)
print("Mode:", mode_value)
print("Variance:", variance_value)
print("Standard Deviation:", std_deviation)
15.Assume your password as your name. Modify the code and the program should output wrong password(if you enter wrong password) or welcome to my page.(if the password is correct)
import getpass
username = input("Enter username: ")
password = getpass.getpass("Enter password: ")
print("Username:", username)
print("Password length:", len(password)) # Just to show it's captured
Comments
Post a Comment