8000 Update README.md · iaman877/Programming-with-Python@b76bba1 · GitHub
[go: up one dir, main page]

Skip to content

Commit b76bba1

Browse files
authored
Update README.md
1 parent c7cb58b commit b76bba1

File tree

1 file changed

+2
-121
lines changed

1 file changed

+2
-121
lines changed

README.md

Lines changed: 2 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -53,124 +53,5 @@ Python has an array of frameworks for developing websites. The popular framewor
5353
* path?
5454
* In order to execute these files( javac java python (command names)), it must locate these files in path environment variables
5555

56-
## Variables
57-
58-
* Variables are containers for storing data values.
59-
* Unlike other programming languages, Python has no command for declaring a variable.
60-
* A variable is created the moment you first assign a value to it
61-
62-
Example :
63-
```python
64-
x = 1234
65-
y = "Aman"
66-
print(x)
67-
print(y)
68-
```
69-
70-
Variables do not need to be declared with any particular type and can even change type after they have been set.
71-
72-
```
73-
x = 78
74-
x = "Illona"
75-
print(x)
76-
```
77-
78-
String variables can be declared either by using single or double quotes:
79-
80-
```
81-
x = "Aman" // is the same as
82-
x = 'Aman'
83-
```
84-
85-
_Variable Names_
86-
87-
88-
A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables:
89-
* A variable name must start with a letter or the underscore character
90-
* A variable name cannot start with a number
91-
* A variable name can only contain alpha-numeric characters and underscores (A-z,0-9,and _)
92-
* Variable names are case-sensitive (age, Age and AGE are three different variables)
93-
94-
95-
_Assign Value to Multiple Variables_
96-
Python allows you to assign values to multiple variables in one line:
97-
98-
Example
99-
100-
```
101-
x, y, z = "X", "Y", 5
102-
print(x)
103-
print(y)
104-
print(z)
105-
```
106-
107-
And you can assign the same value to multiple variables in one line:
108-
109-
```
110-
Example
111-
x = y = z = "O"
112-
print(x)
113-
print(y)
114-
print(z)
115-
```
116-
117-
The Python print statement is often used to output variables.
118-
119-
* To combine both text and a variable, Python uses the + character:
120-
121-
```
122-
x = "A"
123-
print("Python is " + x)
124-
```
125-
126-
* You can also use the + character to add a variable to another variable:
127-
128-
```
129-
x = "life is "
130-
y = "awesome"
131-
z = x + y
132-
print(z)
133-
```
134-
135-
* For numbers, the + character works as a mathematical operator:
136-
```
137-
x = 78
138-
y = 98
139-
print(x + y)
140-
```
141-
* If you try to combine a string and a number, Python will give you an error:
142-
143-
```
144-
x = 20
145-
y = "Aman"
146-
print(x + y)
147-
```
148-
## Global Variables
149-
150-
A variable declared outside of the function or in global scope is known as global variable. This means, global variable can be accessed inside or outside of the function.
151-
152-
```
153-
x = "aman"
154-
def func():
155-
print("Python is " + x)
156-
157-
func()
158-
```
159-
## Standard data types
160-
161-
Built-in Data Types
162-
In programming, data type is an important concept.
163-
164-
Variables can store data of different types, and different types can do different things.
165-
166-
Python has the following data types built-in by default, in these categories:
167-
168-
```
169-
* Text Type :: str
170-
* Numeric Types :: int, float, complex
171-
* Sequence Types :: list, tuple, range
172-
* Mapping Type :: dict
173-
* Set Types :: set, frozenset
174-
* Boolean Type :: bool
175-
* Binary Types :: bytes, bytearray, memoryview
176-
```
56+
57+

0 commit comments

Comments
 (0)
0