-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython_notes.rtf
More file actions
10 lines (9 loc) · 985 Bytes
/
python_notes.rtf
File metadata and controls
10 lines (9 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil Courier New;}{\f2\fnil\fcharset0 Courier New;}}
{\colortbl ;\red136\green136\blue198;\red169\green183\blue198;\red0\green128\blue128;}
{\*\generator Riched20 10.0.14393}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9 converting to a string in python you use the str() function like in ruby .str\par
\pard\box\brdrdash\brdrw0 \sa200\sl276\slmult1\cf1\f1\fs18 print\cf2 (\cf3 "My age is \{0\} years"\cf2 .format(age))\f2\lang1033 its an array so 0 is a slot and so on\f1\lang9\line\cf0\par
\f2\lang1033 look into string format operators\par
While Using \{\} with .format(i, i ** 2, i ** 3\} you can either assign it if you are going to use it more than once \{0\} \{1\} \{2\}, or if you dont need it more than once you can leave brackets empty and python will assign number from 0-2 the other way around you can use in no order and more than once\f0\fs22\lang9\par
}