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

Work

The document contains various Python code snippets demonstrating different programming concepts such as finding the largest number, calculating areas of shapes, determining factorials, and checking for palindromes. It includes user input handling, loops, and conditionals, but also contains numerous syntax errors and typos. Overall, it serves as a collection of programming exercises but requires significant corrections to function properly.

Uploaded by

yousufhk0509
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 views5 pages

Work

The document contains various Python code snippets demonstrating different programming concepts such as finding the largest number, calculating areas of shapes, determining factorials, and checking for palindromes. It includes user input handling, loops, and conditionals, but also contains numerous syntax errors and typos. Overall, it serves as a collection of programming exercises but requires significant corrections to function properly.

Uploaded by

yousufhk0509
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
ya1n2s, 1222 0M Unites # Input three numbers num = float (input("Enter the first number: *)) num2 = float (input("Enter the second nunber: ")) num3 = float(input("Enter the third number: ")) # Determine the Largest number if num >= num2 and numi >= nun3: largest = numt elif num2 >= num1 and num2 >= num3: largest = nun2 else: largest = num3 # Display the Largest number print("The largest number is:", largest) The largest nunber is: 3. ne for i in range(s): nesint(input("enter the marks in this subject")) print('your average percentage is ', (n/500)*100) your average percentage is 85.39999999999995 =int(input( ‘enter the nunber*)) if nc print("your nunber is negitive' ) if me: print(*your nunber is positive’) else: print("the number you gave is @") your number is negitive the number you gave is @ xeinput("enter the the shape you wanna calculate the area for") if xee'circle': reint(input("enter radius of circle")) print(3.14*(r**2)) elif xe='triangle: z=eval(input(‘enter the three sides of triangle in the form of a list')) s=sum(z)/2 print((s*(s-2[@])*(s-2[1])*(s-2[2]))**(1/2)) elif x=='rectangle’ : Zeeval (input (‘enter the lenght & bearth of rectangle in the form of a list’) print(z[@]*2[1]) 6.6 n= int(input(‘enter the nunber to find its factorial')) facte1 for i in range(1,ns1): fact*=i print (fact) 126 ‘ieC:/UsersfaserDownioads/Unilled (1. 8 ya1n2s, 1222 0M Unites int (input (‘enter the limt to the sum ')) su=(n*(n+1))/2 print(su) 28.0 su=0 while (n := int(input())) >= @: suten print(su) 28 for i in range(1,6): for j in range (i): print('$",end="") print() $ $$ $$$ $888 $3888 neinput('enter the number') suse for i in n: su += int(i) print(su) n= int(input("Enter the nunber of terms: ")) for i in range(1, n + 1): value = ((3 * i) - 2) * (-1) ** (i+) print(value, end=", "if i lar: lar= if j< sm: sm=j print(f'the largest number is (lar) and the smallest is {sm}") the largest number is 5 and the smalles is 1 nunbers=eval(input(‘enter the list of nunbers')) for i in range(@, len(nunbers)-1): nunbers[i], nunbers[i +1] = nunbers[i + 1], numbers[i] print (numbers) (2, 3,1 -val (input()) eval (input(‘enter the value to be searched") print(f'the valuse entered is present at index {[Link](en)} ') the valuse entered is present at index 4 nunbers=eval (input (‘enter the list of numbers")) for i in numbers : ifice: neg. append (4) elif ive: [Link](i) print(f'the negitive nymbers are {neg} and the positive nunbers are {pos}") 9, -8, -7] [1, 2, 3, 4 User_list = [x for x in input("Enter elenents for the list separated by spaces: choice = input("Delete by (1) Position or (2) Value? Enter 1 or 2: ").strip() if choice == ‘1': pos = int(input("Enter the positioy if © <= pos < len(user_list): user_list..pop(pos) else: print ("Invalid position.") elif choice == '2": value = input("Enter the valu ‘ieC:/UsersfaserDownioads/Unilled (1. 4s ya1n2s, 1222 0M Unites if value in user_list: user_list. remove (value) else: print("Value not found.") else: print ("Invalid choice.") print("Updated list:", user_list) Updated list: ['1', '2', '3', "4, ‘6, '7", ' d=} int(input(‘entert the number of emplu')) for i in range (n): xzinput(‘enter employe name") yeint(input(‘enter salary")) [Link]((x:y}) print(d) {‘abhilash': 100000, ‘ateb': 67, ‘aqquib': 567} + int (input(‘entert the number of students')) count=1 for i in range (n): nput (‘enter students name*) nt (input (‘enter marks')) y [Link]({(count,x):y}) count+=1 for key,val in [Link](): if val>75 : print (key) (1, ‘abhilash') (2, ‘aquib') (3, ‘ateeb') ‘ieC:/UsersfaserDownioads/Unilled (1. sis

You might also like