Professional Documents
Culture Documents
def main():
print("Input lengths of shorter triangle sides:")
side_a= float(input("a: "))
side_b = float(input("b: "))
main()
return total
def main():
amount = int(input("Number of items: "))
print("The shiping charge: ", shipping(amount))
main()
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
elif b > c:
return b
else:
return c
else:
if a > c:
return a
elif b < c:
return b
else:
return c
def main():
num_a = int(input("First number: "))
num_b = int(input("Second number: "))
num_c = int(input("Third number: "))
main()
First number: 5
Second number: 6
Third number: 8
The median is: 6
def main():
side_a = int(input())
side_b = int(input())
side_c = int(input())
main()
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
6
2
2
Triangle is not valid
def main():
number = int(input("Enter a number: "))
if isPrime(number):
print("{} is a prime number".format(number))
else:
print("{} is not a prime number".format(number))
if __name__ == "__main__":
main()
Enter a number: 2
2 is a prime number
def randomPassword():
length = randint(7, 10)
password = ""
for i in range(length):
char = chr(randint(33, 126))
password = password + char
return password
def main():
print("The random password is: ", randomPassword())
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
if __name__ == "__main__":
main()
for i in p:
if i >= "A" and i <= "Z":
x = True
if i >= "a" and i <= "z":
y = True
if i >= "0" and i <= "9":
z = True
if len(p) >= 8 and x and y and z:
return True
return False
def main():
password = input("Enter a passowrd: ")
if goodPassword(password):
print("Good password")
else:
print("Entered password is not valid!")
if __name__ == "__main__":
main()
def randomPassword():
length = randint(7, 10)
password = ""
for i in range(length):
char = chr(randint(33, 126))
password = password + char
return password
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
def goodPassword(p):
x = False
y = False
z = False
for i in p:
if i >= "A" and i <= "Z":
x = True
if i >= "a" and i <= "z":
y = True
if i >= "0" and i <= "9":
z = True
if len(p) >= 8 and x and y and z:
return True
return False
def main():
attempt = 0
good_password = ""
print(attempt)
print(good_password)
if __name__ == "__main__":
main()
2
T;@<l7."g-
def licensePlate():
list_alph = "A B C D E F J H I J K L M N O P Q R S T U V W X Y Z".split()
list_int = '1 2 3 4 5 6 7 8 9 0'.split()
length = random.randint(3,4)
license = ""
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
if length == 3:
for i in range(6):
if i <= 2:
n = random.randint(0, 25)
license = license + list_alph[n]
else:
n = random.randint(0, 9)
license = license + list_int[n]
elif length == 4:
for i in range(7):
if i <= 3:
n = random.randint(0, 9)
license = license + list_int[n]
else:
n = random.randint(0, 25)
license = license + list_alph[n]
print(license)
def main():
licensePlate()
main()
QEE367
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD