Which of these words is a reserved word in python


This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Show hidden characters

Week3 — Chapter 1- Quiz 1
Q-1 When Python is running in the interactive mode and displaying the chevron prompt (>>>) – what question is Python asking you?
answer- What would you like to do?
2. What will the following program print out:
>>> x = 15;
>>> x = x + 5;
>>> print x
answer- 20
3.) Python scripts (files) have names that end with:
answrs- .py
4.) Which of these words are reserved words in Python ?
answer- if
break
5. ) What is the proper way to say “good-bye” to Python?
answer- quit()
6.) Which of the parts of a computer actually executes the program instructions?
answer- Central Processing Unit
7.) What is “code” in the context of this course?
answer- A sequence of instructions in a programming language
8.) A USB memory stick is an example of which of the following components of computer architecture?
answer- Secondary Memory
9.) What is the best way to think about a “Syntax Error” while programming?
answer- The computer did not understand the statement that you entered
10.) Which of the following is not one of the programming patterns covered in Chapter 1?
answer- Random steps
for any other query/help-
contact — ritikdagar0203@gmail.com

Python Data Structures Week 1 Quiz Answers

Hello Friends in this article i am gone to share Coursera Course: Python Data Structures Week 1 Quiz Answers with you..

Question 1)

When Python is running in the interactive mode and displaying the chevron prompt (>>>) – 

what question is Python asking you?

  • What Python script would you like me to run?
  • What Python statement would you like me to run?
  • What is the air-speed velocity of an unladen swallow?
  • What is the next machine language instruction to run?

Question 2)

What will the following program print out:

>>> x = 15

>>> x = x + 5

>>> print x

  • 15
  • 20
  • x + 5
  • “print x”
  • 5

Question 3)

Python scripts (files) have names that end with:

  • .png
  • .exe
  • .py
  • .doc

Question 4)

Which of these words is a reserved word in Python ?

  • if
  • copy
  • make
  • names

Question 5)

What is the proper way to say “good-bye” to Python?

  • while
  • quit()
  • #EXIT
  • // stop

Question 6)

Which of the parts of a computer actually execute the program instructions?

  • Main Memory
  • Secondary Memory
  • Input/Output Devices
  • Central Processing Unit

Question 7)

What is “code” in the context of this course?

  • A way to encrypt data during World War II
  • A password we use to unlock Python features
  • A set of rules that govern the style of programs
  • A sequence of instructions in a programming language

Question 8)

A USB memory stick is an example of which of the following components of computer architecture?

  • Main Memory
  • Output Device
  • Secondary Memory
  • Central Processing Unit

Question 9)

What is the best way to think about a “Syntax Error” while programming?

  • You will never learn how to program
  • The computer is overheating and just wants you to stop to let it cool down
  • The computer did not understand the statement that you entered
  • The computer has used GPS to find your location and hates everyone from your town

Question 10)

Which of the following is not one of the programming patterns covered in Chapter 1?

  • Random steps
  • Repeated Steps
  • Sequential Steps
  • Conditional Steps

Week 1 Assignment

python
print (“Hello World”)

Here you will get Programming for Everybody (Getting Started with Python) Coursera Quiz Answers

This course aims to teach everyone the basics of programming computers using Python. We cover the basics of how one constructs a program from a series of simple instructions in Python. The course has no pre-requisites and avoids all but the simplest mathematics. Anyone with moderate computer experience should be able to master the materials in this course. This course will cover Chapters 1-5 of the textbook “Python for Everybody”. Once a student completes this course, they will be ready to take more advanced programming courses. This course covers Python 3.

SKILLS YOU WILL GAIN

  • Python Syntax And Semantics
  • Basic Programming Language
  • Computer Programming
  • Python Programming

All Quiz Answers For Week 3

Quiz : Chapter 1

Q1. When Python is running in the interactive mode and displaying the chevron prompt (>>>) – what question is Python asking you?

  1. What would you like to do?
  2. What is your favourite color?
  3. What Python script would you like me to run?
  4. What is the next machine language instruction to run?

Q2. What will the following program print out:

>>> x = 15
>>> x = x + 5
>>> print(x)
  1. 20
  2. 5
  3. 15
  4. “print x”
  5. x + 5

Q3. Python scripts (files) have names that end with:

  1. .png
  2. .doc
  3. .py
  4. .exe

Q4. Which of these words is a reserved word in Python ?

  1. while
  2. payroll
  3. names
  4. pizza

Q5. What is the proper way to say “good-bye” to Python?

  1. #EXIT
  2. while
  3. // stop
  4. quit()

Q6. Which of the parts of a computer actually executes the program instructions?

  1. Secondary Memory
  2. Input/Output Devices
  3. Main Memory
  4. Central Processing Unit

Q7. What is “code” in the context of this course?

  1. A set of rules that govern the style of programs
  2. A password we use to unlock Python features
  3. A sequence of instructions in a programming language
  4. A way to encrypt data during World War II

Q8. A USB memory stick is an example of which of the following components of computer architecture?

  1. Main Memory
  2. Secondary Memory
  3. Central Processing Unit
  4. Output Device

Q9. What is the best way to think about a “Syntax Error” while programming?

  1. The computer has used GPS to find your location and hates everyone from your town
  2. The computer did not understand the statement that you entered
  3. The computer needs to have its software upgraded
  4. The computer is overheating and just wants you to stop to let it cool down

Q10. Which of the following is not one of the programming patterns covered in Chapter 1?

  1. Random steps
  2. Conditional Steps
  3. Repeated Steps
  4. Sequential Steps

All Quiz Answers For Week 4

Quiz : Chapter 2

Q1. In the following code,

print(98.6)

What is “98.6”?

  1. A constant
  2. A variable
  3. An iteration / loop statement
  4. A conditional statement

What is “98.6”?

  1. A constant
  2. A variable
  3. An iteration / loop statement
  4. A conditional statement

Q2. What does the following code print out?

print("123" + "abc")
  1. hello world
  2. This is a syntax error because you cannot add strings
  3. 123abc
  4. 123+abc

Q3. Which of the following is a bad Python variable name?

  1. #spam
  2. SPAM23
  3. spam_23
  4. _spam

Q4. Which of the following is not a Python reserved word?

  1. spam
  2. break
  3. continue
  4. for

Q5. Assume the variable x has been initialized to an integer value (e.g., x = 3). What does the following statement do?

x = x + 2
  1. Exit the program
  2. Retrieve the current value for x, add two to it, and put the sum back into x
  3. Increase the speed of the program by a factor of 2
  4. This would fail as it is a syntax error

Q6. Which of the following elements of a mathematical expression in Python is evaluated first?

  1. Parentheses ( )
  2. Multiplication *
  3. Subtraction –
  4. Addition +

Q7. What is the value of the following expression

42 % 10

Hint – the “%” is the remainder operator

  1. 10
  2. 0.42
  3. 4210
  4. 2

Q8. What will be the value of x after the following statement executes:

x = 1 + 2 * 3 - 8 / 4
  1. 4
  2. 8
  3. 2.0
  4. 5.

Q9. What will be the value of x when the follow

x = int(98.6)
  1. 99
  2. 100
  3. 98

Q10. What does the Python input() function do?

  1. Pause the program and read data from the user
  2. Connect to the network and retrieve a web page.
  3. Read the memory of the running program
  4. Take a screen shot from an area of the screen

All Quiz Answers For Week 5

Quiz : Chapter 3

Q1. What do we do to a Python statement that is immediately after an if statement to indicate that the statement is to be executed only when the if statement is true?

  1. Begin the statement with a curly brace {
  2. Indent the line below the if statement
  3. Underline all of the conditional code
  4. Start the statement with a “#” character

Q2. Which of these operators is not a comparison / logical operator?

  1. >=
  2. =
  3. ==
  4. <=
  5. !=

Q3. What is true about the following code segment:

if  x == 5 :
    print('Is 5')
    print('Is Still 5')
    print('Third 5')
  1. Depending on the value of x, either all three of the print statements will execute or none of the statements will execute
  2. The string ‘Is 5’ will always print out regardless of the value for x.
  3. The string ‘Is 5’ will never print out regardless of the value for x.
  4. Only two of the three print statements will print out if the value of x is less than zero.

Q4. When you have multiple lines in an if block, how do you indicate the end of the if block?

  1. You de-indent the next line past the if block to the same level of indent as the original if statement
  2. You put the colon : character on a line by itself to indicate we are done with the if block
  3. You use a curly brace { after the last line of the if block
  4. You omit the semicolon ; on the last line of the if block

Q5. You look at the following text:

if x == 6 :
    print('Is 6')
    print('Is Still 6')
    print('Third 6')

It looks perfect but Python is giving you an ‘Indentation Error’ on the second print statement. What is the most likely reason?

  1. Python thinks ‘Still’ is a mis-spelled word in the string
  2. You have mixed tabs and spaces in the file
  3. In order to make humans feel inadequate, Python randomly emits ‘Indentation Errors’ on perfectly good code – after about an hour the error will just go away without any changes to your program
  4. Python has reached its limit on the largest Python program that can be run

Q6. What is the Python reserved word that we use in two-way if tests to indicate the block of code that is to be executed if the logical test is false?

  1. else
  2. A closing curly brace followed by an open curly brace like this }{
  3. iterate
  4. otherwise

Q7. What will the following code print out?

x = 0
if x < 2 :
    print('Small')
elif x < 10 :
    print('Medium')
else :
    print('LARGE')
print('All done')

1. All done

2. Small

All done

3. LARGE

All done

4. Small

Medium

LARGE

All done

Q8. For the following code,

if x < 2 :
    print('Below 2')
elif x >= 2 :
     print('Two or more')
else :
    print('Something else')

What value of ‘x’ will cause ‘Something else’ to print out?

  1. x = 2.0
  2. x = -22
  3. x = -2.0
  4. This code will never print ‘Something else’ regardless of the value for ‘x’

Q9. In the following code (numbers added) – which will be the last line to execute successfully?

astr = 'Hello Bob'
(2)   istr = int(astr)
(3)   print('First', istr)
(4)   astr = '123'
(5)   istr = int(astr)
(6)   print('Second', istr)
  1. 4
  2. 1
  3. 2
  4. 5

Q10. For the following code:

astr = 'Hello Bob'
istr = 0
try:
    istr = int(astr)
except:
    istr = -1
  1. 9 (the number of characters in ‘Hello Bob’)
  2. false
  3. -1
  4. It depends on the position in the collating sequence for the letter ‘H’

All Quiz Answers For Week 6

Quiz : Chapter 4

Q1. Which Python keyword indicates the start of a function definition?

  1. sweet
  2. return
  3. continue
  4. def

Q2. In Python, how do you indicate the end of the block of code that makes up the function?

  1. You put the colon character (:) in the first column of a line
  2. You add the matching curly brace that was used to start the function }
  3. You add a line that has at least 10 dashes
  4. You de-indent a line of code to the same indent level as the def keyword

Q3. In Python what is the input() feature best described as?

  1. A built-in function
  2. A user-defined function
  3. A reserved word
  4. The central processing unit

Q4. What does the following code print out?

def thing():
    print('Hello')

print('There')

1.There

2. thing

Hello

There

3. Hello

4. def

thing

Q5. In the following Python code, which of the following is an “argument” to a function?

x = 'banana'
y = max(x)
print(y)
  1. ‘banana’
  2. max
  3. print
  4. x

Q6. What will the following Python code print out?

def func(x) :
    print(x)

func(10)
func(20)

1. x

10

x

20

2. def

x

func

func

3. 10

20

4. x

20

Q7. Which line of the following Python program will never execute?

def stuff():
    print('Hello')
    return
    print('World')

stuff()
  1. return
  2. print(‘Hello’)
  3. def stuff():
  4. stuff()
  5. print (‘World’)

Q8. What will the following Python program print out?

def greet(lang):
    if lang == 'es':
        return 'Hola'
    elif lang == 'fr':
        return 'Bonjour'
    else:
        return 'Hello'

print(greet('fr'),'Michael')

1.Bonjour Michael

2. def

Hola

Bonjour

Hello

Michael

3. Hola Michael

4. Hola

Bonjour

Hello

Michae

Q9. What does the following Python code print out? (Note that this is a bit of a trick question and the code has what many would consider to be a flaw/bug – so read carefully).

def addtwo(a, b):
    added = a + b
    return a

x = addtwo(2, 7)
print(x)
  1. addtwo
  2. 7
  3. 2
  4. 14

Q10. What is the most important benefit of writing your own functions?

  1. Avoiding writing the same non-trivial code more than once in your program
  2. Following the rule that whenever a program is more than 10 lines you must use a function
  3. Following the rule that no function can have more than 10 statements in it
  4. To avoid having more than 10 lines of sequential code without an indent or de-indent

All Quiz Answers For Week 7

Quiz : Chapter 5

Q1. What is wrong with this Python loop:

n = 5
while n > 0 :
    print(n)
print('All done')
  1. This loop will run forever
  2. The print(‘All done’) statement should be indented four spaces
  3. There should be no colon on the while statement
  4. while is not a Python reserved word

Q2. What does the break statement do?

  1. Exits the currently executing loop
  2. Resets the iteration variable to its initial value
  3. Exits the program
  4. Jumps to the “top” of the loop and starts the next iteration

Q3. What does the continue statement do?

  1. Exits the currently executing loop
  2. Resets the iteration variable to its initial value
  3. Exits the program
  4. Jumps to the “top” of the loop and starts the next iteration

Q4. What does the following Python program print out?

tot = 0 
for i in [5, 4, 3, 2, 1] :
    tot = tot + 1
print(tot)
  1. 10
  2. 5
  3. 15
  4. 0

Q5. What is the iteration variable in the following Python code:

friends = ['Joseph', 'Glenn', 'Sally']
for friend in friends :
     print('Happy New Year:',  friend)
print('Done!')
  1. friend
  2. Glenn
  3. Sally
  4. friends

Q6. What is a good description of the following bit of Python code?

zork = 0
for thing in [9, 41, 12, 3, 74, 15] :
    zork = zork + thing
print('After', zork)
  1. Find the smallest item in a list
  2. Count all of the elements in a list
  3. Compute the average of the elements in a list
  4. Sum all the elements of a list

Q7. What will the following code print out?

smallest_so_far = -1
for the_num in [9, 41, 12, 3, 74, 15] :
   if the_num < smallest_so_far :
      smallest_so_far = the_num
print(smallest_so_far)
  1. -1
  2. 74
  3. 42
  4. 3

Q8. What is a good statement to describe the is operator as used in the following if statement:

if smallest is None :
     smallest = value
  1. Is true if the smallest variable has a value of -1
  2. The if statement is a syntax error
  3. Looks up ‘None’ in the smallest variable if it is a string
  4. matches both type and value

Q9. Which reserved word indicates the start of an “indefinite” loop in Python?

  1. for
  2. indef
  3. break
  4. def
  5. while

Q10. How many times will the body of the following loop be executed?

n = 0
while n > 0 :
    print('Lather')
    print('Rinse')
print('Dry off!')
  1. 5
  2. 0
  3. 1
  4. This is an infinite loop
Recap:

I hope this article would be helpful for you to find all the coursera Quiz Answers.
If this article helped you learn something new for free, let others know about this,
Want to learn more? Check out another course.

Enroll on Coursera

<<<Check out another Coursera Quiz Answers >>>

Crash Course on Python Coursera Quiz Answers

The Bits and Bytes of Computer Networking Coursera Quiz Answers

Introduction to User Experience Design Coursera Quiz Answers

Django Features and Libraries Coursera Quiz Answers

Using JavaScript JQuery and JSON in Django Coursera Quiz Answers


There is a restriction while naming identifiers that there are some restricted words that are built-in to Python which cannot be used as an identifier. Python reserved words (also called keywords) a predefined meaning and syntax in the language which Python uses for its syntax and internal processing. In this tutorial, we will discuss what those keywords are.

Table of contents

  • Reserved words
  • Keywords
  • Display all keywords
  • Check if the name is included in the reserved word list
  • Closing Thoughts

Reserved words in Python

Here is the list of all the reserved words in Python.
Note — This list may change with different versions of Python. Python 3 has 33 while Python 2 has 30 reserved words. The print was removed from Python 2 keywords and added as a built-in Python function.

False def if raise
None del import return
True elif in try
and else is while
as except lambda with
assert finally nonlocal yield
break for not
class form or
continue global pass

All the keywords except True, False and None are in lowercase and they must be written as they are. These cannot be used as variable names, function names, or any other identifiers.
If any of the keywords is used as a variable, then we will get the error message SyntaxError: invalid syntax

Keywords

False

It is a boolean operator that represents the opposite of True.

Input:

print (5 == 10)

Output:

FALSE

Since the values are not actually equal, it returns False.

def

The def function is used to define a function or a method in Python.

Input:

def welcome(name):
       print (f"{name}, Welcome to Flexiple")

welcome ("Ben")

Output:

Ben, Welcome to Flexiple

A function ‘welcome’ is defined using the def statement.

if

An if statement is used to make a conditional statement. If the condition is True, then some action is performed.

Input:

age = 19
If age >= 18:
       print ("You are eligible to vote.")

Output:

You are eligible to vote.

Since the age is greater than 18, the condition is True and the print command is executed.

raise

The raise statement is used to raise an error. These errors are visible in the traceback and they cancel the execution of the program if not handled properly.

Input:

enter = "nick"
if not type(enter) is int:
       raise TypeError("Only integers are allowed.")

Output:

TypeError: Only integers are allowed

TypeError is raised if the variable does not contain integers.

None

There is no null value in Python. The None is an object that represents the absence of a value. It is like an empty object.

Input:

age = None
if age is None:
       print ("Invalid result")

Output:

Invalid result

The age variable has no value to it. This satisfies the condition in the if statement.

del

The del statement is used to delete an object in Python.

Input:

name = [‘Ben’, ‘Nick’, ‘Steph’]
del name[1]
print (name)

Output:

[‘Ben’, ‘Steph’]

‘Nick’ is removed from the list.

import

This statement is used to import modules to the project.

Input:

import numpy
import math

This statement will import the NumPy and the math library into the project.

return

This keyword is used to exit a function or a method and return some value.

Input:

def sub(x, y):
       return x + y
print (sub(5, 4))

Output:

1

The function returns the sum of the two variables.

True

It is a boolean operator that represents if the value is True

Input:

print (10 == 10)

Output:

TRUE

The values are same so it returns True.

elif

Shorthand for else if, checks if some other condition holds when the condition in the if statement is false.

Input:

age = 18
if age > 18:
       print ("You are eligible to vote.")
elif age == 18:
       print ("You can vote if you are a registered voter.")
else: 
print ("You are not eligible to vote.")

Output:

You can vote if you are a registered voter.

The condition in the if statement was not True. Hence, the elif statement looked for other conditions that are True.

in

The in statement is used to check if an element is present in an iterable like list or tuple.

Input:

name = ['Ben', 'Nick', 'Steph']
exist = 'Steph' in name
print (exist)

Output:

TRUE

‘Steph’ is present in the name list.

try

The try statement is used to make a try… except statement. The try statement starts a block of code that is tried to execute. If it fails, the except block catches the error.

Input:

a = 5
b = 0 
try:
       div = a/b
except ZeroDivisionError:
       print ("Divisor cannot be zero.")

Output:

Divisor cannot be zero.

The divisor is 0, which is not possible. So the except block catches the error.

and

It is one of the logical operators that returns True if both of the statements are True.
The Truth table for the and operator is as follows:

A B A and B
True True True
True False False
False True False
False False False

Input:

a = 5
b = 10
c = 20
stat1 = b > a
stat2 = c > b
result = stat1 and stat2
print (result)

Output:

TRUE

Both the statements are True and that is why the and operator returns True.

else

Conditional statement that tells to perform alternate action if the condition in the if statement is False.

Input:

age = 16
if age >=18:
       print ("You are eligible to vote.")
else:
       print ("You are not eligible to vote.")

Output:

You are not eligible to vote.

The condition in the if statement was not True, so the alternate action is executed.

is

This statement is used to check if the two variables are equal.

Input:

a = 5
b = 5
print (a is b)

Output:

TRUE

Both the variables point to the same memory place.

while

This statement is used to start a while loop. It continues iteration until a condition is no longer True.

Input:

num = [1, 2, 3]
i = 0

while i < len(num):
       print (num[i])
       i = i + 1

Output:

1
2
3

The loop will run till the value of i is greater than the length of the list.

as

The as statement in Python re-assigns a returned object to a new identifier. Basically, it creates an alias.

Input:

import datetime as dt

today = dt.date.today()
print(today)

The datetime is identified as dt in the code.

except

Part of the type… except errorhandling structure in Python. Tells what to do when an exception occurs.

Input:

a = 5
b = 0 
try:
       div = a/b
except ZeroDivisionError:
       print ("Divisor cannot be zero.")

Output:

Divisor cannot be zero.

As the divisor was zero, the except code block caught the error.

lambda

A lambda function in Python is an anonymous function. It can take any number of arguments but only have a single expression.

Input:

numbers = [1, 2, 3]
cube_nums = map(lambda x: x ** 3, numbers)
print(list(cube_nums))

Output:

[1, 8, 27]

The cube of the variable is an anonymous function.

with

The with statement is used to simplify the exception handling.

Input:

with open("file.txt", "r") as file:
    lines = file.read()

assert

The assert statement in Python is used for debugging.

Input:

def divide(a, b):
    assert b != 0, "Divisor cannot be zero."
    return a / b

divide (5, 0)

Output:

Divisor cannot be zero.

finally

The finally statement is an optional part of try… except error. It always executes the code regardless of whether an error was thrown or not.

Input:

a = 5
b = 0 
try:
       div = a/b
except ZeroDivisionError:
       print ("Divisor cannot be zero.")
finally:
       print ("Error handling complete.")

Output:

Divisor cannot be zero.
Error handling complete.

The print statement under the finally will always execute no matter if there is an error or not.

nonlocal

This keyword is used in functions inside functions to create anonymous functions.

Input:

def outer():
  x = "Welcome"
  def inner():
    nonlocal x
    x = "to Flexiple"
  inner() 
  return x
print(outer())

Output:

to Flexiple

yield

The yield function ends a function and returns an iterator.

Input:

def nums():
    i = 0
    while True:
        yield i
        i += 1
        
for num in nums():
    print(num)

Output:

1
2
3
4
5
6
7
.
.
.

This is an infinity loop and will never end.

break

It is a control flow statement used to come out of a loop.

Input:

age = 19
if age >= 18:
       print ("You are eligible to vote.")
       break

Output:

You are eligible to vote.

As soon as the condition is satisfied, the break statement ends the loop.

for

The keyword is used to create a for loop.

Input:

num = [1, 2, 3]
cube = []
for number in num:
    cube.append(number ** 3)

print (cube)

Output:

[1, 8, 27]

This loop will run till all the elements in the list are gone through it.

not

It is another logical operator that returns False when the value is True and vice versa.
The truth table for not operator:

A not A
True False
False True

class

The class keyword is udes to define a class in Python.

from

This statement is used when you can to include a specific part of the module.

Input:

from math import sqrt
print(sqrt(9))

Output:

3

The whole math module is not imported, only a specific function is imported into the project.

or

It is a logical operator that returns True if any one of the statements is True.
Here is the truth table for or operator

A B A or B
True True True
True False True
False True True
False False False

Input:

stat1 = True
stat2 = False
result = stat1 or stat 2
print (result)

Output:

TRUE

One of the statements is True and according tot the truth table, the or operator will return True.

continue

It is a control flow statement used to continue to the next iteration of a loop. Unlike break, the continue statement does not exit the loop.

Input:

age = [12, 14, 15, 16, 18]
for number in age
print ("Not eligible")
if age >=18:
continue      
print ("You are eligible to vote.")
break

Output:

Not eligible
Not eligible
Not eligible
Not eligible
You are eligible to vote.

The condition in the if statement is not satisfied by the first element. The loop should end there but due tot he continue statement, the loop continues.

global

Accessing a global variable is simple as any other variable but to modify a global variable, you need to use the global keyword.

Input:

age = 18

def check():
       global age
       age = 16

check()
print (age)

Output:

16

The age variable is a global variable and we cannot change it’s value without using the global statement.

pass

It is a null statement in Python that will do nothing.

Input:

def sub(a, b)
  pass
class Student
  pass

It is used as a placeholder for future code. It simply prevents getting errors when an empty code is run.

Display all keywords

We can display the full list of all the keywords in the current version of Python by typing the following command in the Python interpreter.

import keyword
print (keyword.kwlist)

And to find out the number of reserved words in Python.

print (len(kewyord.kwlist))


Check if the name is included in the reserved word list in Python

To check if the name is a part of the list of reserved keywords in Python, we can use the keyword.iskeyword() function.

Input:

import keyword
print (keyword.iskeyword(“global”))
print (keyword.iskeyword(“print”))

Output:

TRUE
FALSE

Closing Thoughts

Python reserved words designate special language functionality. No other variable can have the same name as these keywords. We read about all the reserved keywords and how to check if the name is a keyword or not. One can learn about more Python concepts here.

These solutions are for reference only.

It is recommended that you should solve the assignment and quiz by yourself honestly then only it makes sense to complete the course.

but if you cant figure out some part of it than you can refer these solutions

make sure you understand the solution

dont just copy paste it

——————————————

Q-1 When Python is running in the interactive mode and displaying the chevron prompt (>>>) – what question is Python asking you?

answer-   What would you like to do?

2.   What will the following program print out: 

     >>> x = 15; 

     >>> x = x + 5;

     >>> print x

answer-  20

3.)  Python scripts (files) have names that end with:

answrs-  .py

4.)  Which of these words are reserved words in Python ?

answer-  if

         break

5. ) What is the proper way to say “good-bye” to Python?

answer-  quit()

6.)  Which of the parts of a computer actually executes the program instructions?

answer- Central Processing Unit

7.) What is “code” in the context of this course?

answer- A sequence of instructions in a programming language

8.) A USB memory stick is an example of which of the following components of computer architecture?

answer-  Secondary Memory

9.) What is the best way to think about a “Syntax Error” while programming?

answer- The computer did not understand the statement that you entered

10.) Which of the following is not one of the programming patterns covered in Chapter 1?

answer- Random steps 

reference :coursera.org

Like this post? Please share to your friends:
  • Which is row and which is column in excel
  • Which of the four words is the group word перевод
  • Which is not the synonym for the word remote
  • Which of the following word roots can not
  • Which is not an excel function category