CodeTantra Python Programming L8 Solution

In this blog post, you will find all the Solutions to the L8 questions of the Codetantra Python Programming Course. Here are the answere to these question:-

Codetantra python programming L8

Q1:- L8/Input and Output Statements/Reading input in Python-strings :- Write a program to print your favourite place.

place= input(“Enter your favourite place: “)
print(“My favourite place is”,place)

Q2:- L8/Input and Output Statements/Understanding Output in Python :- Identify the error and correct the given code

lang = input(“Enter Language: “)

print(“My Favourite Language is”, lang)

Q3:- L8/Input and Output Statements/Output of Python :- Understand and retype the below code to know more about print().

name =”Pretty”

branch =”CSE”

score =”10″

print(“Hello”, name, “your branch is”, branch, “and your score is”, score)

Q4:- L8/Input and Output Statements/% - formatting and str.format() function :- Follow the instructions given in comment lines and write the program to understand format method.

#Take an integer input from the user and store it in variable “a”
a= int(input(“a: “))

#Take an integer input from the user and store it in variable “b”
b = int(input(“b: “))

#print “a” value at 8 index and “b” value at 1 index
print(“The value of a= {}, b={}”.format(a,b))

#print by changing the index postions of “a” and “b” and observe the output

print(“The value of a = {}, b = {}”.format(b,a))

Q5:- L8/Input and Output Statements/% - formatting and str. format() function :- Use the format specifiers concept and write the program in the given editor by following the comment lines. Observe the output

# take float number from the user
a = float(input(“a: “))

# print up to 2 decimal points
print(“{0:.2f}”.format(a))

# print up to 6 decimal points
print(“{0:.6f}”.format(a))

# take int number from the user
b = int(input(“Enter b value: “))

# print the number with one space
print(“{0:2d}”.format(b))

# print the number with two spaces
print(“{0:2d}”.format(b))

# print the number with three spaces
print(“{0:3d}”.format(b))

# print the given number b in octal form
print(“octal:”, oct(b) [2:])

# print the given input bin hexadecimal form

print(“hex:”,hex(b).upper()[2:])

Q6:- L8/Basics of Python Programming/Basics of Python :- Select all the correct statements from the given options.

Python is used by most of the top companies.

By using Python we can implement GUI.

Python is not sufficient to implement web based development

In Mathematics we are unable to use Python

Python is a cross platform language

Q7:- L8/Basics of Python Programming/Difference between Compiler and Interpreter :- Select all the correct statements from the given options.

In Python intermediate code is generated.

Compiler takes entire block of code as a single unit to check and identify the errors in program.

Memory allocation is more in Python due to creation of Object code at the time of source code compilation.

Hope this blog post was helpful to you and you have got the answer to your question. Thank you for visiting our blog. If you have any doubts about any coding questions then let us know in the comments section we will answer them as soon as possible. Till then check out our more blog posts.

Leave a Comment

Your email address will not be published. Required fields are marked *