Python Projects for Beginners a ten-Week Bootcamp Approach to Python Programming



Download 2,61 Mb.
bet25/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   21   22   23   24   25   26   27   28   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

Writing Comments


In Python, we can write comments using the hash (#) symbol. Any text that follows this symbol will be commented out. In the cell below our markdown header, let’s write our first comment:

# this is a comment

Let’s go ahead and run the cell. Notice that nothing happens. This is because the computer completely ignores any comments. For the most part, we’ll write comments on their own line; however, in certain instances you may see comments written in line with code. In the same cell as the previous comment, let’s add the following line:

print("Hello") # this is also a comment

The first portion of this line will run and output “Hello”, but the second part will be ignored because of the hash symbol.
Note Markdown uses hash characters for headers, like python comments. Make sure you know what type your cell is set to “markdown/cell.”
To write multiline comments so that you may write more descriptive paragraphs for larger portions of code, we would need to use three opening and closing double quotes:

" " "
This is a multi-Line comment
" " "
print("Hello") # this is also a comment

ChApTer 2 pyThoN BAsICs
Go ahead and run the cell. Notice that the text within the multiline comment gets ignored. These types of comments are great for adding descriptive paragraphs about your code. Be sure not to overuse them, however, as you can certainly make a mess of a program by using too many of them.
What Are Data Types?
Almost all languages use data types, they are essential to every program. Data types are how we define values, likes words or numbers. If I were to ask you what a sentence is made up of, you would probably reply with “words or characters.” Well, in programming, we call them strings. Just the same as we refer to numbers as their own data type as well. Data types define what we can do and how these values are stored in memory on the computer. In Table 2-1, you’ll find that each row displays a data type, a sample value, and a description for each. Read each section for a longer explanation for each type. You can find the four basic types that we cover this week within the table.
Table 2-1. Data type examples


Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   21   22   23   24   25   26   27   28   ...   200




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish