-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.py
72 lines (60 loc) · 1.26 KB
/
demo.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# print('Hello')
# a=3
# if a <= 3:
# print('Value of a:',a)
# print('Hello next print')
# # variables
# a = 'hello'
# a,b,c = 1,2,3
# print(a)
# print(b)
# print(c)
# print(type(a))
# name = 'python'
# # print('Hello '+name)
# # global var
# funname = 'hello python' #this is a global variable
# def demofunction():
# print(name)
# demofunction()
# # a->b
# # array['sadfa','asdf','sdf']
# # array[0]
# # data type conversiton
# a = '1'
# b = 1.0
# print(a)
# print(type(b))
# print(type(int(b)))
import random
print(random.randrange(2000,2005))
string = '''hello
hi
how are you'''
astirng = ' hello python '
alist = ['hello','hi','how','are','you']
print(alist[-1])
print(astirng[-9])
print(astirng.islower())
print(astirng.replace('hello','hi'))
print(len(astirng))
num = 46
print('hell' in astirng)
print('Hello number+',num)
print('hello {0}, welcome to {1}'.format('Vanshika','Python'))
print("Hello \"New\" Python")
print(astirng.count('h'))
# print(type(astirng.translate))
avalue = 5
b = 6
# avalue += 7
print('b value:',b)
print('SUm of avalue is:',avalue)
print(astirng.islower())
if (not(avalue == 6)):
print('Get bothe value')
listval = [1, 2, 3, 4]
print(next(iter(int,listval)))
# print(next(iter(listval)))
# for num in [1,2,3,4]:
# print(num)