-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.py
More file actions
49 lines (45 loc) · 832 Bytes
/
variables.py
File metadata and controls
49 lines (45 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#The following program is to show various uses of variables in python
#integer assignment
institution = "zetech University"
Name = "Pelu Jeremiah"
Hobbies ="Programming,Gaming"
#prints Results
print(institution)
print(Name)
print(Hobbies)
#Assigning a single value to multiple variables
a=b=c=d=25
#Prints results
print(a)
print(b)
print(c)
print(d)
#Assigning different values to multiple variables
a,b,c=20,30,56
#print results
print(a)
print(b)
print(c)
p="pelusharaz"
p="the best programmer"
#prints result
print(p)
#operators with variables
p="pelusharaz"
q=" loves programming"
a=" with python"
#results
print(p+q+a)
#global and local variables
def f():
global s
s="never"
print(s)
s="How do i become a good programmer"
print(s)
#global scope
s="pretend to be one"
print(s)
s="when do i stop"
print(s)
f()