This is the solution to Quiz 4: Problems - Python values, variables, types.

The following figure illustrates the grade distribution for this quiz.

Maximum possible points is 100.



This quiz aims at testing your basic knowledge of Python’s print function, and the how to string manipulation in Python.
Don’t forget to push your answers to your remote repository by the end of quiz time. Push your quiz-4 readme.md file to quiz/4/ folder in your Github project. If you write your answers in Python scripts, put the script files in the same folder as well.
If you feel uncertain about your answer, you can test your final codes on Jupyter or IPython command lines.

  1. Write a single-line python script, that prints your full name 5 times, each on a separate line.

    Answer:
    print('Amir Shahmoradi\n'*5)
    

    Amir Shahmoradi Amir Shahmoradi Amir Shahmoradi Amir Shahmoradi Amir Shahmoradi

  2. Write a single-line python script, that applies the relevant Python string manipulator methods to this string,

    Python Is Great For String Manipulation.
    

    and transforms it to the following string and and prints it on screen,

    .noitalupinaMgnirtSroFtaerGsInohtyP
    


    Answer:

    print( "Python Is Great For String Manipulation.".replace(' ','')[::-1] )
    
    .noitalupinaMgnirtSroFtaerGsInohtyP
    


  3. Name the three major types of programming errors.

    Answer:
    syntax, runtime, and semantic errors.


Comments