0% found this document useful (0 votes)
4 views11 pages

Pps File

Hrjdisosoaznznhdid9w01028373g4v4vrvfhxuisjssnwb8e92i2jejdke929281872838rid

Uploaded by

mayuratakare9552
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views11 pages

Pps File

Hrjdisosoaznznhdid9w01028373g4v4vrvfhxuisjssnwb8e92i2jejdke929281872838rid

Uploaded by

mayuratakare9552
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
Programiz Python Online Compiler main.py 2G Sove princ("Onkar_pacil") princ(*Roll_NO.D34") 1 2 3 4° N =int(input("Enter number of elements you want in list:")) 5 Data = [] 6 7+ for i in range (N): 8 x = anc(inpuc("Enter number: ")) 9 Data append(x) 10 princ(*Last 4s : *.Daca) WW Even = [] 12 Odd =] 13+ for x in Data 14- if(x %2 == 0) 15 Even. append(x) 16- else: 7 Odd .append(x) 18 princ( "List of even numbers is : ",Even) 19 print(*List of odd numbers is : “,Odd) © scanned with OKEN Scanner Output Onkar_Patil Roll_NO.D34 Encer Encer Enter Enter Enter Enter Lise 1s runber Punber punber nunber nunber runber of elements you want in lists 04 05 07 " 34 4,5, 7, 11, 34 Lise of even numbers is : [4, 34] Lise of odd numbers is : (5, 7, 11] Code Execution Successful = Cleer © scanned with OKEN Scanner Programiz Python Online Compiler main.py 25 G&G Save En print(*Onkar_Patil™) princ("Roll_No.D34") #(A) inbuilt functions (squareroot, square, cube) import math num = int(input("Enter number to find squreroot, square and cube of number = ")) 7 squareroot = math.sqrt(num) 8 print("Squareroot of", num, “using inbuilt function is: “,squarercot) 9 square = macth.pow(nun, 2) 10 print("\nSquare of", num, “using inbuilt function is: ",square) 11 cube = math.pow(num, 3) 12. print("\nCube of", num, “using inbuilt function is: ", cube) 13, auweuna © scanned with OKEN Scanner Programiz PRO > Output Clear Onkar_Patil Roll_No.D34 Enter number to find squreroot, square and cube of number : 4 Squareroot of 4 using inbuilt function is: 2.0 Square of 4 using inbuilt function is: 16.0 Cube of 4 using inbuilt function is: 64.0 Code Execution Successful = © scanned with OKEN Scanner jopramiz Python Online Compiler main.py af prant(*Onker_Patil") print(*Roll_No.34") ylargest number ,Prime number) S+ def fabonacci() 4(B) User defined functions (Fibonacci series, Factorial, Pallindrone 6 Mo = int(input(*Enter number till which you want to print fibonaccd series: ")) 7 first_val = 0 8 second_val = 1 9 1=0 10> whiLe(a def checkprime() 24 um=inc(input(*Enter nurber to check prine or not ")) 25* for i in range(2,num) 26+ Af (num % 1 0): 27 print (num, "is not a prime number") 28 break 29+ else: 30 print (num, "is a prime number") SD) break 32> def largest(): 3 intCinput(*Enter first number:")) 34 ntCinput(*Enter second number:")) 35 ne3=ancCinpur(“Enter third number:")) 36- —-Af(no1>no2) end (noz>n03): 7 princ(not,*is largest number*) 38> eli f(no2>no3): © scanned with OKEN Scanner jogramiz Python Online Compiler mainpy 2G) soe SE 39 print(nol,"is largest number") 40~ else a princ(no3,*1s largest nunber*) 42. # (C) Sinple calculator operations using menu driven funcezons 43~ def add(): 4a Nol = int(inpuc("Encer first number: ")) as. No2 = int(input(“Enter second number : “)) 46 Mo3+Not = Noz 47 print("Addition of numbers is : ", No3) 48+ def subtract() 49 Nol = int(inpuc("Encer first number: ")) 50 No2= int(input( "Enter second number: ")) 51 No3 =No1-No2 52, print("Subtraction of numbers is - ",No3) 53+ def multiplication() 54 Not = int(inpuc("Encer first number > ")) 55 No2 = int(inpuc("Enter second number : ")) 56 No3=No1*No2 57 princ("Mulciplication of numbers is : *, No3) . © scanned with OKEN Scanner ? amiz Python Online Compiler main.py at 57 print("Nultiplicacion of numbers 1s No3) 58 def division() 59 Not = int(input("Enter first number = ")) 60 No2 = int(input("Enter second number = *)) 6 No3-Not / No2 62 princ("Addition of nunbers is : ", No3) 63 64 print(*\n-- -Nenu- 4 65 princ(*\nTo print fabonacct series, enter 1") 68 print¢"To print factorial of number, enter 2") 67 print("To Check prime number, enter 3") 68 print("To print largest number, enter 4") 69 print(*To print addition of numbers, enter 5") 70 print(*To print subtraction of numbers, enter 6") 71 print(*To print mulciplication of numbers, enter 7") 72 print(*To print division of numbers, enter 8") 73 princ(*To exit enter 0") 74 75> while(1) 18 choice=(ine(inpuc("\nenter option = "))) © scanned with OKEN Scanner Programiz Python Online Compiler main.py s&s ES 1): T+ Af (choice 78 fabonacci() 79° elif (choice == 2) 80 factortal() Bly elif (choice == 3): 82 checkPrime() 83+ elif (choice 4): 84 lergest() 85- elif (choice == 5): | 86 addQ) 87> elif (choice 6): 83 subtract() 89° elif (choice : 90 multiplicationt Ne elif (choice 8) 92 division() 93- elif (choice 0): 98 Princ("\nProgram execution stopped") 95 exit() 96 © scanned with OKEN Scanner Programiz PRO > Output Clear Onkar_Patil . Roll_No.34 Menu: To print fabonacct series, enter 1 To print factorial of number, enter 2 To Check prime number, enter 3 To print largest number, enter 4 To print addition of numbers, enter 5 To print subtraction of numbers, enter 6 To print multiplication of numbers, enter 7 To print division of numbers, enter 8 To exit enter 0 Enter option : 2 Enter number to get factorial: 5 Factorial of 5 is 120 © scanned with OKEN Scanner Output To To To To To To To To To print fabonacei series, enter 1 print factorial of number, enter 2 Check prime number, enter 3 prant largest number, enter 4 print addition of nutbers, enter 5 print subtraction of numbers, enter 6 Print multiplication of numbers, enter 7 print division of numbers, enter 8 exic encer 0 Enter option : 2 Enter number ro ger factorial 5 Factorial of 5 is 120 Enter option : 0 Program execution stopped Code Execution Successful === Clear © scanned with OKEN Scanner

You might also like