-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut.py
107 lines (94 loc) · 2.39 KB
/
tut.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# x = 5
# y = 6
# total = x + y
# print(total)
# first_name = 'rudr aksh'
# last_name = 'bohra'
# print(first_name.islower())
# print(first_name.upper())
# print(first_name.rsplit())
# print(first_name.isalpha())
# sentence = f'{first_name} {last_name} is a coder'
# print(sentence)
# lst = [1,2,3,4,5,'hello',['a','b','c']]
# print(lst[0])
# print(lst[-1])
# print(lst[-2][0])
# lst[0] = 100
# print(lst)
# random_number_list = [10,32,20,45,42,41,69]
# random_number_list.sort()
# print(random_number_list)
# random_number_list.sort( reverse = True)
# print(random_number_list)
# random_number_list.append('hello world')
# print(random_number_list)
# s = 'Rudraksh'
# ls = list(s)
# print(ls)
# ls.sort()
# print(ls)
# a = [1,2,3]
# b = [3,4,5]
# c = a + b
# print(c)
# a.append(b)
# print(a)
# a.extend(b)
# print(a)
#aaj set aur dictionary krvaya(7/16/22) [print:reserved in python,print_:not reserved in py]
# map_ = {
# 'first_name': 'Rudraksh',
# 'second_name': 'Bohra',
# 'company':'regex'
# }
#print(map_['first_name'])
#print(map_.get('age','not found'))
#print(map_.get('company','not found'))
# company = map_.pop('company')
# print(company)
# print(map_)
# looping syntax
#lst = [1,2,3,4,5,6,6,7,8,4,10]
# for i in lst[2:]:
#for i in 'Rudraksh':
# for i in range(1, 10):
# print(i)
# for i in range(0,len(lst),2):
#print(lst[i])
# for i in[1,2,3]:
# for j in ['a','b','c']:
# print(i,j)
# lst = [1,3,7,24,16,27,19]
#prime no in python assignment
# fname = 'rudraksh'
# lname = 'bohra'
# if fname == 'rudraksh' and lname == 'bohra':
# print('yes first name is rudraksh')
# else:
# print('yes last name is bohra')
# if fname == 'rudraksh' or lname == 'bohra':
# print('yes first name is rudraksh')
# else:
# print('no first name is not rudraksh')
# if 'rudraksh' in ['a','b','c']:
# print('rudraksh is in list')
# elif 'p' in 'rudraksh':
# print('p is in rudraksh')
# elif 'k' in 'rudraksh':
# print('k is in rudraksh')
# else:
# print('kuch nahi mila')
# take an input from an user and print the users whose ascii value is even
# s = input('enter a string:')
# for i in s:
# if ord(i) % 2 == 0:
# print(i)
#/take 5 inputs from the users and append all those inputs in the list
# s = int(input('enter any integer value'))
# lst=[]
# for i in range(s):
# num = input()
# lst.append(num)
# print(lst)
#/ take n*2 input from user in 2,2 sets