- Get link
- X
- Other Apps
Data Driven Decision
Making
B.Com (Business Analytics)
Sem I
Questions from 1 to 5 :: PYTHON
Q1. Write a program to print the following sentences, Hello Everyone and Welcome to the world of Python.
#program starts here
print("Welcome to python class")
|
Q2. Write a program
to print two statements “Hello World” and “I am learning Python”. a.
Concatenate the
strings b.
Split the
strings To concatenate: #To write a program to print two statements “Hello World” and “I am learning Python" S1= 'Hello World' S2= 'I am learning Python' S3 = S1 + ", " +S2 print (S3) To split #To write a program to print two statements “Hello World I am learning Python" and split S = 'Hello World, I am learning Python' S1= S.split() print(S1) # With separator S2 = S.split(" , ") print(S2) The output of Q1 and Q2 Q3. Write a program to insert student details – Name, Father’s name, Hall ticket number, Date of birth, age, Stream of study, College name. #Write a program to insert student details – Name, Father’s name, Hall ticket number, Date of birth, age, Stream of study, College name. Name = input ('Enter your name') Fathername = input('Enter your father name ') Hno = input('Enter Your hall ticket number ') DOB = input('Enter your date of birth') Age = input ('Enter your age') Stream = input('Enter your stream') College = input('Enter your college name') print("Hai", Name, ",", "Your Fathername is", Fathername) print("Your hall ticket number is", Hno, "Your DOB is", DOB) print("Your age is", Age, "Your stream is", Stream)
print("You are studying at", College) Q4. Write a program to prepare the list of rainbow colours and print the second colour in the "Rainbow" list. #Write a program to prepare the list of rainbow colours and print the second colour and fourth colour in the "Rainbow" list. Rainbow = ["Red", "Orange", "Yellow", "Green", "Blue","Indigo","Violet"] print (Rainbow) print(Rainbow[0]) print (Rainbow[4]) Q5. Write a program to assign two values to the variables a and b and perform the mathematical operations addition, subtraction, multiplication, division, square of a number. #arithmetic operations a = 10 b = 20 print("The sum of a and b = ",a+b ) print("The difference of a and b = " , a-b) print("The product of a and b = ", a*b) print("The quotient of a and b = ", a/b) print("The square of a = ", a**2, "and Square of b = ", b**2)
|
- Get link
- X
- Other Apps
Comments
Post a Comment