Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Pre-Lab Tasks: Answer as directed: 1) is a short form of else if statement in Python. 2) Python uses to form a block of

python image text in transcribed
image text in transcribed
image text in transcribed
Pre-Lab Tasks: Answer as directed: 1) is a short form of "else if "statement in Python. 2) Python uses to form a block of code. 3) loop is a definite loop. 4) is a built-in function in Python that is used to iterate over a sequence of numbers. 5) Which of the following is placed after the if condition? a): b) : c). d) , 6) It is necessary that every if statement should have an else block. (True/False) 7) Floating point numbers can be used for checking equality in the test expression. (True/False) 8) Fill in the blanks to print "welcome" on the screen: x=15y=500if(x>100y>100):print("welcome") 9) not 1=1 gives the answer 10) The loop below is an example of loop. i=1. while i>0 : print( "welcome") 11) What is exactly printed by this code? for z in range(3, 5,1) : print (zz) a) 3,5,1 on separate lines b) 9,16 on separate lines c) 9,16,25 on separate lines d) None 12) What is the output of this code with speed =55. Output is if speed 4 : y=17 if y>10; print("ok*) else: print("no") printefyes") 14) How many timies will the losp nut? for (iar ravedis): prinuii) a) 5 b) infinite e) 4 d) 0 15) Function ratige (3) is cquivalent is: a) range(1,3) b) range(0,3) c) range(0.3.1) d) range(1,3. Lab Tasks: Task 1: loentify the erous (ibseme variables are initialized) and phe reasess: Task 2: Whan is the exput of the following code snippete? Task 3: Write a Python program that prompts the user to enter an alphabet. If entered alphabet is lower case convert to upper ease and then determine if it is a vowel. Letters A,E,I,O, and U are vowels. Hint: Use of built-in function upper0 or lower0 is allowed. Consider use of membership operator. Task 4: Write a Python program to check if an integer entered by the user is positive, negative or zero, using if, elif and else only once in the program. Task 5: Write a program to enter an integer and calculate the sum of its digits. Task 6: Write a program using for loop to print all numbers from m to n, thereby classifying them as even or odd. Post Lab Tasks: 1) Write Python code that does the following: if the value of a variable, v, is less than 5, print "KU" v times. Otherwise print "Hello" once. 2) Write a Python program to determine if the user inputs a digit, alphabet or a whitespace. 3) Write a Python program that reads your score and outputs the corresponding grade according to the following (you may assume that the grade has no decimal point): 4) Write a program to that displays all numbers from 1100 that are not divisible by 2 as well as by 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions