Skip to content

Commit 3c9ce31

Browse files
committed
uploading files
0 parents  commit 3c9ce31

File tree

4 files changed

+270
-0
lines changed

4 files changed

+270
-0
lines changed

binary converter.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import os
2+
os.system('color b')
3+
jett = True
4+
while jett :
5+
os.system('cls')
6+
als = input('From binary to number type btn, from number to binary type ntb: ')
7+
if als == 'btn' :
8+
print('write your number in binary (without spaces) and i will convert it to a real number ')
9+
x = input()
10+
x = x [::-1]
11+
val = 0
12+
counter = 0
13+
for i in x :
14+
if i == '1':
15+
val = val + (2 ** int(counter))
16+
counter = counter +1
17+
print(val)
18+
input()
19+
else :
20+
print('write your number and i will convert it to binary')
21+
z = int(input())
22+
arr = []
23+
arr2 = []
24+
arr3 = []
25+
vounter = 0
26+
if z == 1 :
27+
print(1)
28+
elif z == 0 :
29+
print(0)
30+
else :
31+
while z > 0 :
32+
counter = 0
33+
while 2 ** counter <= z :
34+
counter = counter + 1
35+
counter = counter - 1
36+
arr.append(counter)
37+
z = z - (2 ** counter )
38+
for i in range(65) :
39+
arr3.append(i)
40+
for i in arr3 :
41+
if i in arr :
42+
arr2.append('1')
43+
else:
44+
arr2.append('0')
45+
st = ''.join(arr2)
46+
st = st[::-1]
47+
more = st.index('1')
48+
r = st[(more):]
49+
r = ' '.join(r)
50+
print(r)
51+
input()
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
# ans = input('Do you want to run again ? yes or no ?')
65+
# if ans == 'yes' :
66+
# jett = True
67+
# else :
68+
# jett = False

guess my number.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import os
2+
os.system('color b')
3+
os.system('cls')
4+
omen = True
5+
while omen :
6+
os.system('cls')
7+
jett = input('if you want me to guess your number type pop \nif you want to guess my number type bob')
8+
if jett == 'bob' :
9+
print('i will choose a random number from 1 to 100 and you have to guess it \ni will guide you along the way')
10+
import random
11+
x = random.randint(1,100)
12+
guess = int(input('what is your guess ?'))
13+
counter = 1
14+
while guess != x :
15+
while guess>x :
16+
print('no your guess is high')
17+
guess= int(input('try again '))
18+
counter = counter + 1
19+
20+
while guess<x :
21+
print('no your guess is low')
22+
guess= int(input('try again '))
23+
counter = counter + 1
24+
25+
print('you got me it took you ' +str(counter) +' tries')
26+
input()
27+
# import random
28+
# os.system('cls')
29+
# x = random.randint(1,100)
30+
# guess = int(input('what is your guess ?'))
31+
# counter = 0
32+
# while guess!=x :
33+
# if guess > x :
34+
# os.system('cls')
35+
# print('no your guess is high')
36+
# guess= int(input('try again '))
37+
# counter = counter + 1
38+
# elif guess < x :
39+
# os.system('cls')
40+
# print('no your guess is high')
41+
# guess= int(input('try again '))
42+
# counter = counter + 1
43+
44+
45+
46+
if jett == 'pop' :
47+
import random
48+
print('choose a random number from 1 to 100 and i will guess it ')
49+
input('press enter when you are ready ')
50+
x = random.randint(1,100)
51+
ans = input('is ' + str(x) + ' your number yes or no ?')
52+
maximum = 100
53+
minimum = 0
54+
counter =1
55+
while ans == 'no' :
56+
reply = input('is my guess high or low ?')
57+
if reply == 'high' :
58+
maximum = x-1
59+
x= random.randint(minimum,(x-1))
60+
ans =input('is ' + str(x) + 'your number yes or no ?')
61+
counter = counter + 1
62+
63+
64+
elif reply == 'low' :
65+
minimum = 1 + x
66+
x = random.randint((x+1),maximum)
67+
ans =input('is ' + str(x) + ' your number yes or no ?')
68+
counter = counter + 1
69+
70+
print ('i got you it took me '+ str(counter) + ' tries')
71+
input()
72+
sage = input('do you want to try again yes or no ?')
73+
if sage == 'yes' :
74+
omen = True
75+
else :
76+
omen = False

series and parallel calculations.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import os
2+
os.system('color b')
3+
os.system('cls')
4+
5+
# TOC stands for type of connection
6+
pap = True
7+
while pap :
8+
os.system('color a')
9+
os.system('cls')
10+
TOC = input('series or parallel ?')
11+
if TOC == 'series' :
12+
NOR = int(input('what are the number of resistors ?'))
13+
# NOR stands for number of resistors
14+
15+
16+
SA = range(0,NOR)
17+
# SA stands for series array
18+
counter = 0
19+
SA2 = []
20+
# SA2 stands for series array number 2
21+
22+
23+
24+
for i in SA :
25+
counter = counter + 1
26+
value = int(input('what is the value of resistor number ' + str(counter) + ' in ohm' + ' ?'))
27+
SA2.append(value)
28+
29+
req = 0
30+
# req stands for equivilant resistance
31+
32+
for i in SA2 :
33+
req = req + i
34+
35+
print('equivilant resistance is ' + str(req) + ' ohm')
36+
input()
37+
38+
39+
40+
elif TOC == 'parallel' :
41+
NOR = int(input('what is the number of resistors ?'))
42+
43+
PA = range(0,NOR)
44+
counter = 0
45+
PA2 = []
46+
for i in PA :
47+
counter = counter +1
48+
voepr=int(input(('what is the value of the resistor number ' + str((counter)) + ' in ohm ?')))
49+
PA2.append(voepr)
50+
PA3 = []
51+
for i in PA2 :
52+
i = float((1/i))
53+
PA3.append(i)
54+
55+
sezo = 0
56+
for i in PA3 :
57+
sezo = sezo + i
58+
59+
sezo= float(1/sezo)
60+
print('equivilant resistance is ' + str(sezo) + ' ohm')
61+
input()
62+
tap = input('do you want to run again yes or no ?')
63+
if tap == 'yes' :
64+
pap = True
65+
else :
66+
pap = False

youtube downloader.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import os
2+
import time
3+
from pytube import YouTube
4+
5+
os.system('cls')
6+
os.system('color b')
7+
8+
9+
url = input("Please paste the youtube uniform resource allocator : ")
10+
vedio = YouTube(url)
11+
choice = input("Audio or vedio (a or v) ? : ")
12+
13+
14+
15+
if choice == "v" :
16+
17+
options = vedio.streams.filter(adaptive = True)
18+
print("-"*80)
19+
print("\n"*2)
20+
21+
for i in options :
22+
print (i)
23+
24+
print("\n"*2)
25+
print("-"*80)
26+
print ("\n" * 3)
27+
28+
quality = input("Please type the itag value : ")
29+
name = input("\n" +"Type the file name : ")
30+
print("\n" +"downloading..." + "\n")
31+
32+
result = vedio.streams.get_by_itag(quality)
33+
result.download("youtubedownloads",filename = name)
34+
35+
36+
37+
38+
else :
39+
40+
options = vedio.streams.filter(only_audio=True)
41+
print("-"*80)
42+
print("\n"*2)
43+
44+
for i in options :
45+
print (i)
46+
47+
print("\n"*2)
48+
print("-"*80)
49+
print ("\n" * 3)
50+
51+
quality = input("Please type the itag value : ")
52+
name = input("\n" +"Type the file name : ")
53+
print("\n" +"downloading..." + "\n")
54+
55+
result = vedio.streams.get_by_itag(quality)
56+
result.download("youtubedownloads",filename = name)
57+
58+
59+
print("Done good bye ")
60+
time.sleep(2)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy