This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = [1,2,3,4,5,6,7,8,9] | |
num = int(input("Enter the desired number of divisions:")) | |
temp = 0 | |
for i in list: | |
if i%num == 0: | |
temp += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [] | |
while True: | |
num = int(input('Enter number:')) | |
numbers.append(num) | |
if len(numbers) == 10: | |
break | |
neg_nums = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [] | |
while True: | |
num = int(input('Enter number:')) | |
numbers.append(num) | |
if len(numbers) == 10: | |
break | |
print("Negative Numbers:",sum(i < 0 for i in numbers )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [] | |
positive_nums = [] | |
negative_nums = [] | |
while True: | |
num = int(input('Enter number:')) | |
numbers.append(num) | |
if len(numbers) == 10: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = [5,1,4,2,8] | |
for num in range(len(list)-1,0,-1): | |
for i in range(num): | |
if list[i] > list[i+1]: | |
list[i],list[i+1] = list[i+1],list[i] | |
print(list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Please enter numbers') | |
print('You can terminate by entering -1 when you enter as many numbers as you want') | |
numbers = [] | |
sorted_nums = [] | |
while True: | |
num = int(input('Number:')) | |
numbers.append(num) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Please enter numbers') | |
print('You can terminate by entering -1 when you enter as many numbers as you want') | |
numbers = [] | |
while True: | |
num = int(input('Number:')) | |
numbers.append(num) | |
if num == -1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = [-1, -2, 0, 1, 2, 3, 4, 5, 18, 6] | |
class count: | |
temp = 0 | |
templist = [] | |
def max(self): | |
max = 0 | |
for i in list: | |
if i > max: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
def __init__(self): | |
self.make = "Lamborghini" | |
self.model = "Gallardo" | |
self.car_segment = "supercars" | |
self.year = "2013" | |
self.body_style = "coupe" | |
self.top_speed = 325 | |
self.speed = 0 | |
self.gas = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Determine the range of prime numbers you want to find") | |
num_1 = int(input("Lower limit:")) | |
num_2 = int(input("Upper limit:")) | |
print("Prime numbers between", num_1, "and", num_2) | |
for i in range(num_1, num_2 + 1): | |
if i > 1: | |
for num in range(2, i): |
OlderNewer