“Generator Algoritma Python” Kode Jawaban

Nomor acak Python

from random import randint

print(randint(1,3))

#Possible Outputs#
#1
#2
#3
DatMADCoder

Generator Algoritma Python

Name = input("Enter name of student: ")
Address = input("Enter Full Address: ")
Mobile = int(input("Enter Mobile NUmber: "))
Colg = input("Enter name of College: ")
Course = input("Enter the Course Name: ")
Sub1 = input("Enter the core subject1: ")
Sub2 = input("Enter the core subject2: ")
print()
print("Name:", Name, "Address:", Address, "Mobile:", Mobile, "College:", Colg, "Course:", Course, " 
Sub1:", Sub1, " Sub2:", Sub2)
print()
print()
print("Name:", Name)
print("Address:", Address)
print("Mobile:", Mobile)
print("College:", Colg)
print("Course:", Course)
print("Sub1:", Sub1)
print("Sub2:", Sub2)
Brave Bear

Generator Algoritma Python

list1=[]
i=int(input('Enter the length of the list : '))
for x in range(0,i):
 y=float(input('Enter the numbers for the list : '))
 list1.append(y)
print(f'Your Inputted List is : {list1}')
#To Find the largest number
max1=max(list1)
#To Find the position of the largest number
index1=list1.index(max1)
print(f'The largest number of the list is {max1}, and the position is{index1}.') 
Witty Walrus

Generator Algoritma Python

Name = input("Enter name of student: ")
Address = input("Enter Full Address: ")
Mobile = int(input("Enter Mobile NUmber: "))
Colg = input("Enter name of College: ")
Course = input("Enter the Course Name: ")
Sub1 = input("Enter the core subject1: ")
Sub2 = input("Enter the core subject2: ")
print()
print("Name:", Name, "Address:", Address, "Mobile:", Mobile, "College:", Colg, "Course:", Course, " 
Sub1:", Sub1, " Sub2:", Sub2)
print()
print()
print("Name:", Name)
print("Address:", Address)
print("Mobile:", Mobile)
print("College:", Colg)
print("Course:", Course)
print("Sub1:", Sub1)
print("Sub2:", Sub2)

Brave Bear

Generator Algoritma Python

import numpy as np
import sys

def inverse(a):
    n = len(a) #defining the range through which loops will run
    #constructing the n X 2n augmented matrix
    P = np.eye(n)

    a = np.concatenate((a, P), axis=1)
    
    #main loop for gaussian elimination begins here
    for k in range(n):
        if abs(a[k][k]) < 1.0e-12:
            for i in range(k+1, n):
                if abs(a[i][k]) > abs(a[k][k]):
                    for j in range(k, 2*n):
                        a[k][j], a[i][j] = a[i][j], a[k][j] #swapping of rows
                    break
        pivot = a[k][k] #defining the pivot
        if pivot == 0: #checking if matrix is invertible
            print("This matrix is not invertible.")
            return
        else:
            for j in range(k, 2*n): #index of columns of the pivot row
                a[k][j] /= pivot
            for i in range(n): #index the subtracted rows
                if i == k or a[i][k] == 0: continue
                factor = a[i][k]
                for j in range(k, 2*n): #index the columns for subtraction
                    a[i][j] -= factor * a[k][j]
    for i in range(len(a)): #displaying the matrix
        for j in range(n, len(a[0])):
            print(a[i][j], end = " ")
        print()
        
a = np.array([[0, 2, 1], [1, 1, 2], [2, 1, 1]])
# n = len(a)
# a = np.concatenate((a, np.eye(n)), axis=1)
print(inverse(a))
Zülal Özgül

Jawaban yang mirip dengan “Generator Algoritma Python”

Pertanyaan yang mirip dengan “Generator Algoritma Python”

Lebih banyak jawaban terkait untuk “Generator Algoritma Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya