GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python_programs/generic.py at master · SomnathDange/python_programs

Expand file tree

/

generic.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
62 lines (55 loc) · 1.2 KB
/

generic.py

Copy path

File metadata and controls

62 lines (55 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#Print elemets from triangular index from a given list
numbers = [34,2,8,56,91,7]
for i in range(1,len(numbers)):
sum = 0
for j in range(1,i):
sum = sum + j
if sum >= len(numbers):
break
print numbers[sum]
output:
34
2
56
##Get unique values from a list
numbers = [34,2,8,56,91,7,2,8,11,55,91]
uniq_list = []
for i in numbers:
if i not in uniq_list:
uniq_list.append(i)
print uniq_list
#Output = [34, 2, 8, 56, 91, 7, 11, 55]
##Print minimum element from list
numbers = [34,2,8,56,91,7,2,8,11,55,91]
final = []
while numbers:
min = numbers[0]
for i in numbers:
if i < min:
min = i
final.append(min)
numbers.remove(min)
print final
##Print Maximum element from list
numbers = [34,2,8,56,91,7,2,8,11,55,91]
final_mav = []
while numbers:
max = numbers[0]
for i in numbers:
if i > max:
max = i
final_mav.append(max)
numbers.remove(max)
print final_mav
#Reverse string
name = "Somanath Dange"
rev_str = ""
for i in name:
rev_str = i + rev_str
print rev_str
#Reverse string word by word
name = "my name is shivansh"
str = name.split(" ")
name_str = str[::-1]
rev_str1 = ' '.join(name_str)
print rev_str1
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.