You are on page 1of 7

LEARNING JOURNAL UNIT 1

PART ONE

>>> print(Dorinda Tandoh')

If you print the string in python after leaving out one or both quotation marks then it will show an
error because in python strings are declared by using both quotation marks of single or double-quotes.

This is because it will be hard to determine the end or the beginning of the string.

Print List Without Quotation Marks according to Finxter

To print a string list without quotes, use the expression '[' + ', '.join(lst) + ']' to create a single string
representation of the list without the quotes around the individual strings.

Here’s an example:

# Print List Without Quotes

lst = ['1', '2', '3']

# Create List Representation

s = '[' + ', '.join(lst) + ']'

# Print List

print(s)

# [1, 2, 3]
2. What is the difference between * and ** operators in Python?

According to the course syllabus, the operator ** performs exponentiation; that is, it raises a number to
a power: >>> 6**2 + 6 will give you a result of 42 whiles the operator * is multiplication

>>> 6 * 7 will give you a result of 42

3. >>> 09
leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

4. >>> type('67') and >>> type(67)

>>> type('67')

<class 'str'>
>>> type(67)

<class 'int'>

In these results, the word “class” is used in the sense of a category; a type is a category of values. Not
surprisingly, integers belong to the type int, strings belong to str, and strings are in quotation marks
according to the course syllabus.

PART 2

a. >>> 36*2
To multiply numbers in Python, we use the multiplication operator *. It is made up of just an
asterisk. If it appears between two numbers in Python, those numbers will multiply each other.
If we type 36 * 2 in the Python Interactive Shell, we will get 72 as the output. It does not matter
if these numbers are of different types, they can still multiply each other and give an output.
According to Django Central, Multiplication in Python is done by ( * ) operator, Then the result is
saved in the product variable and printed out using string formatting. However, the more
memory-efficient way to perform a multiplication in Python is by not using any variables at all it
can be done in a line, but it can make the code hard to read

b. >>> ('Africa, Ghana, Accra')


The quotation marks in the program mark the beginning and end of the text to be displayed;
they don’t appear in the result.
I read on other platforms, different ways to display countries and cities using python and how to
extract them. This is how I displayed mine, open to suggestions.
c. You can type date without parameters to display the current date
setting and a prompt for a new date. Press Enter to keep the
same date. If you provide a date in the format MM-DD-YY, the
system date is set to that date
You can also type "date" into the command prompt window and
press "Enter." The current date setting will now display, type
"time" into the command prompt window and press "Enter." The
current time setting will now display.
This was asking for the date of final exam and it was very difficult for me to do that. I hope to
learn more on how to do that on this platform.
>>> ('08-10-23')

D. >>> curl wttr.in


It is difficult for me to display the temperature of my country. I used the code above because I did a
research on the internet on how to display the temperature using the command prompt. I don’t know
why, the output displayed an error and hope to learn more on this platform.

You might also like