Question

In: Computer Science

Python #For question 1 and 2 you may not use ''' ''' Question 1 Print the...

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

Solutions

Expert Solution

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:

  • (b). methods

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:

  • (d)All of the above

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.


Related Solutions

you may not use the Python ord() or chr() functions you may not use the Python...
you may not use the Python ord() or chr() functions you may not use the Python ord() or chr() functions you may not use the Python ord() or chr() functions You will write a total of four functions, each of which will take two inputs and return a string: c_encrypt() c_decrypt() vig_encrypt() vig_decrypt() The first argument will be a string containing the plaintext (or clear text) message to be encrypted for the two encrypt functions, and a string containing a...
Python age = input(‘How old are you? ’) if age >= 14 print(‘You may go on...
Python age = input(‘How old are you? ’) if age >= 14 print(‘You may go on the rollercoaster’) Read carefully - What will the program output if the user types ‘15’? 2. Concisely explain the difference between ‘while’ and ‘for’ ______________________________________________ 3.The __________statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop. 4.The ____________ statement is used to skip the rest of the code inside a loop for the...
Use Python: Develop neurons and print truth table of the following 2-input logic gates: AND, OR,...
Use Python: Develop neurons and print truth table of the following 2-input logic gates: AND, OR, NAND, NOR, XOR, XNOR and 1-input NOT gate (Notice: use Markdown to explain how you developed a neuron, and to insert images showing the truth table of logic gates before coding)
On Python a) Use format() method to print an integer value entered by the user and...
On Python a) Use format() method to print an integer value entered by the user and its cube root with two decimal places. b) Print the same values as part (a) using format() function with keyword arguments and labels number and cubeRoot as in: format(number=n,cubeRoot=cr) c) Switch the order of keyword arguments and show that this has no effect on the output.
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the...
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the application. >---=== Python Temperature Analyzer ===---< 3- Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low. Print the following messages: > * Read the high value. > Enter the high value for day 1: < (or day 2,...
2) create a python program that uses a for loop and range to print out the...
2) create a python program that uses a for loop and range to print out the values 10 8 6 4 2 3) Create a python program that yses a for loop to print out ["bob","al","bert"]
Important: please use python. Using while loop, write python code to print the times table (from...
Important: please use python. Using while loop, write python code to print the times table (from 0 to 20, incremented by 2) for number 5. Add asterisks (****) so the output looks exactly as shown below.   Please send the code and the output of the program. ****************************************************************** This Program Shows Times Table for Number 5 (from 0 to 20) Incremented by 2 * ****************************************************************** 0 x 5 = 0 2 x 5 = 10 4 x 5 = 20 6...
EXPLAIN ANS PLEASE: PYTHON 1. s = 'abc' print(s[0:] + s[-2:2] + s[:1]) 2. def mirrorOnWheels(s):...
EXPLAIN ANS PLEASE: PYTHON 1. s = 'abc' print(s[0:] + s[-2:2] + s[:1]) 2. def mirrorOnWheels(s): prev = 0 for current in range(1, len(s) - 1): prev = current - 1 next = current + 1 if s[prev] == s[next]: break else: continue return 0 return prev s = 'Good decision!' print(mirrorOnWheels(s)) 3. mixture = {1:[1, 2, 0], 2:[2, 0, 1], 0:[0, 1, 2]} print(mixture[2][2]) 4. noOddHeroes = [] heroes = ['superman', 'batman', 'aquaman'] for hero in heroes: if len(hero)...
Using Python. In this question, you are expected to use TensorFlow and Keras to perform a...
Using Python. In this question, you are expected to use TensorFlow and Keras to perform a deep learning process for creating an image classifier to distinguish between dog and cat. You should follow fchollet’s code to create the classifier and test this classifier with one test photo of dog and one test photo cat. Create a screenshot to show the classifying results of these two test photos. The dog and cat in the test photos should not be in your...
Use Python: # Problem Set 01: - Develop neurons and print truth table of the following...
Use Python: # Problem Set 01: - Develop neurons and print truth table of the following 2-input logic gates: AND, OR, NAND, NOR, XOR, XNOR and 1-input NOT gate (Notice: use Markdown to explain how you developed a neuron, and to insert images showing the truth table of logic gates before coding) # Problem Set 02: - Develop neuron and print truth table of XOR gate using only NAND gates - Develop neuron and print truth table of XOR gate...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT