1. input two values from user and exchange the contents of two variables without using multiple assignment operation in a single statement.
2. Input the temperature of an object in Celsius/ Fahrenheit and display the output temperature after converting to Fahrenheit/Celsius respectively where C/5 = (F-32)/9.
3. Input no. of days from user and display it as years months days format.
4. Input no. of seconds from the user and display the hours: minutes: seconds. Don't show hours if it is ZERO.
5. Input an integer from the user ( 0 < n < 10000) and display the number of digits in it. (Try both using loop and if separately)
6. Input a binary integer and convert to corresponding decimal number.
7. Input two positive integers from the user and display the cube roots of all the numbers within the given range.
8. Input an integer and display the prime factors of the given numbers.
9. Input a real no. X and the number of terms N and evaluate the following series: F = (X – 1) (X – 2)(X – 3) ….. (X – N)
10. Input a positive integer and display the sum of squares of each digit. If input is 641, the output will be after calculation of 62 + 42 + 12 = 53
1. x, y = 5, 7
cond1 = y > x and y>=2 cond2 = y < x < 3
final = cond2 or cond1 print("final",final,sep = '=')
2. import math
first = int(math.sqrt(20)) - 11%3 + math.floor(-100.847) print(math.fabs(first))
3. If value of x and y are 23 and 25 respectively find the output of the following code: if x > y:
x, y = 10, x + 10
elif x - 3 <= 4*y**0.5: x, y = 21, 12
elif y - 2 == x: x, y = 30, 28
else:
x = y = 20 print(x,'#',y)
4. a, b= 4, 20
while a < b:
print(a, b, b*a//3) a,b = 2*a+1, b-1
5. import math
m1 = int(input()) while m1>0 :
print(m1%3,end = ' ')
p = 2 * math.ceil(math.log(m1,2)) m1 = math.floor(math.log10(m1)) if p > 5:
print("Continue") continue
print(p)
6. x = 14
for i in range(8): if x < i:
break
x = x - i*2 print(x, end = ' ')
7. for cv1 in range(5, 11, 2):
pro = cv1
for cv2 in range (1,cv1,3): pro += cv2
print(pro,end = '$#$') else:
print("No pro")
C. Re-write the following program code after removal of error and underline the corrections only: 1. axt = 12, byt = 15
Print(axt x byt) Print(axt^2)
2. a = input() b = 27
if a = b - 21: if a > b:
a - b/4 = x else if a ≤ b:
Print(a mod b):
else:
a = true, b = 0
3. a = true b = false c = 5
While a and b not print (c : sep = 3) c - 1 = c
a = b, b = a
4. z = 100
a = b = 2
For I Range (10,3,1) 3ab = 3 * a * b
z /= 2
a = a + 3 b = b - 3 if a ≠ b
Print(Z1)
1. Find the correct variable names from the following:
Else, x1y2z3, 16E5, 3.14, Ph#No, _983589422, “Hello”, while
2. Which of the following is/are not correct function name? Value( ), 2sqrt( ), IsValid( ), if( ), _321( )
3. Identify the correct literals along with their type:
1.00562, pass, “Welcome”, 3e02, elif, ‘continue’, Ox67
4. Classify the followings as keywords or identifiers: Loop, complex, class, IsAlpha
1. How empty statement is implemented in Python? Why is it required?
2. Explain the functionality of else with if and loop with suitable example.
3. Differentiate between break and continue. Cite examples for each.
4. Why for loop is called deterministic loop and while loop is called non- deterministic loop?
5. What do you mean by type promotion? Show a suitable example.
6. Describe the explicit type conversion using example.
7. State the requirements of comments and indentation in a program.
8. Write down the purpose of iteration.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme