Computer Science Question
Q1) Write a code in python that display the list:
Final=[0,-3,5,100,5,10,30]
-
Print the list
-
Find how many elements the list contains
-
Add number 3 to the third element which is 5. It should be replicated by 8.(5+3)
-
Print the new list. (The output should be [0,-3,8,100,5,10,30])
-
Find the last element of the list using length
Q2) what is the difference between code 1 and code 2?
Code 1:
F0=open(“foo.txt”,”wb”)
Foo.closed
Code 2:
F0=open(“foo.txt”,”wb”)
Foo.close()
Q3) deff(a,b=1, c=2)
This defined function prints values of arguments passed to the parameters, the write output of:
F(2, c=2)
F(c=100, a=110)
Q4) The syntax of opening file in python for both reading and writing format is:
Q5) write a code in python that welcomes the user when the username and password is correct.
-
Username: “python”
-
Password: “12345”
Output should be
DETAILED ASSIGNMENT