Nexclap

regression problems in machine learning

here is my blog on regression problems in machine learning

https://www.siliconvalley4u.com/blogs/regression-in-machine-learning

Geometric Progression

This python program asks the user to input the number of characters they want to use in a list. The user then inputs multiple numbers to form their list. The program runs through these numbers and checks if their list forms a geometric progression. If this sequence creates a geometric progression, the ratio of that progression is shown as well.

firstlist = [] # The list with the inputted numbers. secondlist = [] # The list with the division between each number. length = int(input("How many numbers do you want in the list? ")) # Ask user how many numbers in sequence. # The user inputs a number and that number is added to the firstlist def inputlist (length): for x in range(0, length): number = float(input("Type your number: ")) firstlist.append(number) division = 0 # Every two numbers in firstlist are divided, and the divided number is added to secondlist. def divlist (length): for y in range(0, length): if y < (len(firstlist)-1): division = (firstlist[y + 1] / firstlist[y]) secondlist.append(division) inputlist(length) divlist(length) counter = 0 # Counter to count the number of times the ratio is equal to each other. firstnum = secondlist[0] # The list of all numbers from secondlist are compared to each other to see if they are similar or not. def geometric (secondlist, firstnum, counter): for x in secondlist: if firstnum == x: # This if-statement is to start the counter with the base of 1. firstnum == x counter = counter + 1 if counter == len(secondlist): # If the progressed counter is equal to the number of numbers in the list, then geometric progression exists. print("This sequence is a geometric progression. The common ratio is", firstnum) if x == secondlist[len(secondlist)-1] and counter != len(secondlist): # If x is equal to the last number in the division list (to make sure the list is ran through) and the counter isn't equal to the number of characters in the list, a geometric progression does not exist. print("This is not a geometric progression.") geometric(secondlist, firstnum, counter)

Temperature advice code

This code tells you about the temperature. It also tells advice on wether you should wear short sleeves or long sleeves.

advice= "yes" while advice == "yes": advice = input("Would you like advice to wear shorts or long pants") temperature = float(input('What is the temperature?')) if temperature > 70: print('Wear shorts.') else: print('Wear long pants.') print('Get some excersise.') for i in [1, 2, 3]: i += 1 print(i)
Announcements
  • Test Announcement from Nexclap

    Test message from nexclap - please ignore

    2023-02-13

  • Test message

    Test message from nexclap - please ignore

    2023-02-11

  • Test message

    Test message from nexclap - please ignore

    2023-02-11

  • View all