Skip to content

Commit f728ae7

Browse files
authored
Merge branch 'geekcomputers:master' into master
2 parents d2d1054 + b49bae4 commit f728ae7

File tree

423 files changed

+121786
-1595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+121786
-1595
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
.idea
22
*.pyc
3+
string=sorted(input())
4+
lower=""
5+
even=""
6+
odd=""
7+
upper=""
8+
for i in string:
9+
if i.islower():
10+
lower+=i
11+
elif i.isupper():
12+
upper+=i
13+
elif int(i)%2==0:
14+
even+=i
15+
else:
16+
odd+=i
17+
print(lower+upper+odd+even)
18+
19+
# operating system-related files
20+
21+
# file properties cache/storage on macOS
22+
*.DS_Store
23+
24+
# thumbnail cache on Windows
25+
Thumbs.db

12

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import turtle
2+
t = turtle.Turtle()
3+
t.circle(20)
4+
t1=turtle.Turtle()
5+
t1.circle(25)

56

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
t = turtle.Turtle()
2+
t.circle(50)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"""
2+
Problem:
3+
The prime factors of 13195 are 5,7,13 and 29. What is the largest prime factor
4+
of a given number N?
5+
6+
e.g. for 10, largest prime factor = 5. For 17, largest prime factor = 17.
7+
"""
8+
9+
10+
# def solution(n: int) -> int:
11+
def solution(n: int = 600851475143) -> int:
12+
"""Returns the largest prime factor of a given number n.
13+
>>> solution(13195)
14+
29
15+
>>> solution(10)
16+
5
17+
>>> solution(17)
18+
17
19+
>>> solution(3.4)
20+
3
21+
>>> solution(0)
22+
Traceback (most recent call last):
23+
...
24+
ValueError: Parameter n must be greater or equal to one.
25+
>>> solution(-17)
26+
Traceback (most recent call last):
27+
...
28+
ValueError: Parameter n must be greater or equal to one.
29+
>>> solution([])
30+
Traceback (most recent call last):
31+
...
32+
TypeError: Parameter n must be int or passive of cast to int.
33+
>>> solution("asd")
34+
Traceback (most recent call last):
35+
...
36+
TypeError: Parameter n must be int or passive of cast to int.
37+
"""
38+
try:
39+
n = int(n)
40+
except (TypeError, ValueError):
41+
raise TypeError("Parameter n must be int or passive of cast to int.")
42+
if n <= 0:
43+
raise ValueError("Parameter n must be greater or equal to one.")
44+
45+
i = 2
46+
ans = 0
47+
48+
if n == 2:
49+
return 2
50+
51+
while n > 2:
52+
while n % i != 0:
53+
i += 1
54+
55+
ans = i
56+
57+
while n % i == 0:
58+
n = n / i
59+
60+
i += 1
61+
62+
return int(ans)
63+
64+
65+
if __name__ == "__main__":
66+
# print(solution(int(input().strip())))
67+
import doctest
68+
69+
doctest.testmod()
70+
print(solution(int(input().strip())))

ABC

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Python3 program to add two numbers
2+
3+
number1 = input("First number: ")
4+
number2 = input("\nSecond number: ")
5+
6+
# Adding two numbers
7+
# User might also enter float numbers
8+
sum = float(number1) + float(number2)
9+
10+
# Display the sum
11+
# will print value in float
12+
print("The sum of {0} and {1} is {2}" .format(number1, number2, sum))

AREA OF TRIANGLE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Python Program to find the area of triangle
2+
#calculates area of traingle in efficient way!!
3+
a = 5
4+
b = 6
5+
c = 7
6+
7+
# Uncomment below to take inputs from the user
8+
# a = float(input('Enter first side: '))
9+
# b = float(input('Enter second side: '))
10+
# c = float(input('Enter third side: '))
11+
12+
# calculate the semi-perimeter
13+
s = (a + b + c) / 2
14+
15+
# calculate the area
16+
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
17+
print('The area of the triangle is %0.2f' %area)

ARKA

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def sumOfSeries(n):
2+
x = (n * (n + 1) / 2)
3+
return (int)(x * x)
4+
5+
6+
7+
# Driver Function
8+
n = 5
9+
print(sumOfSeries(n))

ASCIIvaluecharacter

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Program to find the ASCII value of the given character
2+
3+
c = 'p'
4+
print("The ASCII value of '" + c + "' is", ord(c))

Aakanksha

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import time
2+
pwd="AKS2608" #any password u want to set
3+
4+
def IInd_func():
5+
count1=0
6+
for j in range(5):
7+
a=0
8+
count=0
9+
user_pwd = input("") #password you remember
10+
for i in range(len(pwd)):
11+
if user_pwd[i] == pwd[a]: #comparing remembered pwd with fixed pwd
12+
a +=1
13+
count+=1
14+
if count==len(pwd):
15+
print("correct pwd")
16+
break
17+
else:
18+
count1 += 1
19+
print("not correct")
20+
if count1==5:
21+
time.sleep(30)
22+
IInd_func()
23+
24+
IInd_func()

Add two numbers

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# User pick two numbers to sum
3+
4+
num1 = float(input("Number 1:"))
5+
num2 = float(input("Number 2:"))
6+
7+
# Add two numbers
8+
sum = num1 + num2
9+
10+
# Display the sum
11+
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

0 commit comments

Comments
 (0)