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

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)...
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...
write code in python and test Conversation with an AI ChatBot Learning Outcomes: Use the print()...
write code in python and test Conversation with an AI ChatBot Learning Outcomes: Use the print() function to output a variety of data Use the input() function to ask for multiple data types Use basic arithmetic operations in a program Use string methods and operations Use if/else if/else statements to determine the flow of the program Comment your code Debug your code Test your code Scenario A new marketing company is launching an Artificial Intelligence (AI) ChatBot for their website...
Use this information for New Tech Company to answer the following question. You may (or may...
Use this information for New Tech Company to answer the following question. You may (or may not) need to fill in missing information.           NEW TECH COMPANY Income Statement 2010 2011 2012 Sales 100 110 120 Cost of goods sold 50 51 52 Depreciation 20 20 20 General, sales & admin expenses 70 65 60 Taxes 10 10 10 Net Income Balance Sheet 2010 2011 2012 Current Assets 40 45 40 Property, plant & equipment 60 55 60 Total Assets...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT