Last answered:

04 Dec 2023

Posted on:

01 Dec 2023

0

Resolved: İntro to conditionals

İn the task below:

x = 5
y = 6
#
print('x =',x,'y =',y)
print('Checking less than with \'<\':',x < y)
print('Checking greater than with \'>\':',x > y)


İs the sign < or > should always be written with with ':' expression ? 

1 answers ( 1 marked as helpful)
Instructor
Posted on:

04 Dec 2023

0

Hey Khadija,


Thanks for reaching out!


The <, >, and : symbols are all part of a print-statement. Inside the print-statement, there is a set of esaped quotation marks such that the printed text becomes:

Checking less than with '<':

To answer your question, < or > don't need to be followed by a colon.


If you need a refresher on strings, please refer to the following lectures:

https://learn.365datascience.com/courses/python-programmer-bootcamp/print-function/

https://learn.365datascience.com/courses/python-programmer-bootcamp/the-solution/


Kind regards,

365 Hristina


Submit an answer