In: Computer Science
Python
#For question 1 and 2 you may not use ''' '''
Question 1 Print the messages below without using variables.
Output must be 2 lines identical to below:
What is the snake's favorite language?
"I love Python", said the snake.
Question 2 Write a python statements to match the 5 lines of output below.
Use a single print statement to produce the list of 4 languages
The 3 most popular programming languages of 2020 are:
1. Python
2. Javascript
3. Java
4. C#
-Source: https://www.northeastern.edu/graduate/blog/most-popular-programming-languages/
Question 3 (Multiple Choice)
lstrip and rstrip are examples of Python
(a)complex data types
(b)methods
(c)structures
(d)string variables
Question 4 (Multiple Choice)
What is true about Python variables?
(a)They are labels that can be assigned to values
(b)They reference a certain value
(c)A variable name cannot start with a number
(d)All of the above
Answer:
Raw code for question one and two
# question 1
print('What is the snake\'s favorite language?\n"I love Python", said the snake.')
#question 2
print('The 3 most popular programming languages of 2020 are:\n1. Python\n2. Javascript\n3. Java\n4. C#')
Editor:
output:
Question 3:
Reason: The lstrip() and rstrip() are the string methods which are used to remove the whitespace characters on the left side of the string using lstrip() and rightside using rstrip().
Question 4:
Reason: All the above statements are true for variables variables are the label names which is used to assign values they reference to certain variable which we previously assigned and we cannot start or declare a variable name starting with a digit.
Hope this helps you! If you still have any doubts or queries please feel free to comment in the comment section.
"Please refer to the screenshot of the code to understand the indentation of the code".
Thank you! Do upvote.