Python Assignment For Absolute Beginners
Python Assignment For Absolute Beginners
A. yes
B. no
C. machine dependent
D. none of the mentioned
A. ~variablename
B. varaiable-name
C. 5_variablename
D. Variable_name
Options: -
A. The program will loop indefinitely
B. The value of number will be printed exactly 1 time
C. The while loop will never get executed
D. The value of number will be printed exactly 5 times
A. x^y
B. x**y
C. x^^y
D. None of the mentioned
5) What is the output of this code?
Options: -
A. 021324
B. 012345
C. Error
D. 102435
6) Answer Carefully
Option: -
A. TRUE
B. TRUE
FALSE
C. FALSE
TRUE
D. TRUE
FALSE
TRUE
Options: -
A. 66
0
B. 36
0
C. 66
3
D. 36
3
9) Which of these is not a core data type?
A. Lists
B. Dictionary
C. Tuples
D. Class
10) The following code contains an infinite loop. Which is the best
explanation for why the loop does not terminate?
Options: -
A. n starts at 10 and is incremented by 1 each time through the loop,
so it will always be positive.
B. answer starts at 1 and is incremented by n each time, so it will
always be positive.
C. You cannot compare n to 0 in the while loop. You must compare it
to another variable.
D. In the while loop body, we must set n to False, and this code does
not do that.
Write the code for the following programs:
1) Write a program to take input from user for shopping amount. For
amount, greater than 1000 shopkeeper gives 10 percent discount
and for amount below 1000 he gives 5 percent discount. Write a
program to display percent discount and amount of discount
applicable