Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

PythonExercises Part2

This document provides a series of Python exercises involving variables, data types, string slicing, comments, and string concatenation. The exercises have the user declare variables to store a quote, name, and total from user input; add comments to identify data types and explain program functions; use string slicing to extract part of a variable; and print a sentence combining a variable and string using concatenation. Completing these exercises helps practice key Python concepts like variables, data types, comments, string manipulation, and user input/output.

Uploaded by

alvaro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

PythonExercises Part2

This document provides a series of Python exercises involving variables, data types, string slicing, comments, and string concatenation. The exercises have the user declare variables to store a quote, name, and total from user input; add comments to identify data types and explain program functions; use string slicing to extract part of a variable; and print a sentence combining a variable and string using concatenation. Completing these exercises helps practice key Python concepts like variables, data types, comments, string manipulation, and user input/output.

Uploaded by

alvaro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Exercises – Part 2

1. Declare and assign a variable stores your favourite movie quote or song lyrics in a
variable called quote or lyric
2. Declare and assign a variable that stores your name
a. Add a comment that states what variable type this is
3. Write a program in python that asks the user for 3 numbers then saves the total in a
new variable
a. Print the total back to them
b. Add a multi line comment that explains what this program does
4. Add a comment that states the data type of the following variable: x = 43.56
5. As a comment, state what letter will be printed to the screen after running in the
following code:

6. As a comment, state what letter will be printed to the screen after running in the
following code:

7. Use string slicing to print ´if´ from the variable statement, shown above
a. Add a comment to explain how string slicing works
8. Name = “Jimmy”
Print a sentence that includes the variable above, you must make use of string
concatenation
9. As a comment, state what the following code will print
a. Explain why you think this

You might also like