Python paper-Information Systems assignment help

Python paper-Information Systems assignment help

# Week 2 Code Part 1 #example 1 – type find “””x = int(input(“Please enter an integer: “)) if x < 0: x = 0 #indentation -please note print(‘Negative changed to zero’) elif x == 0: print(‘Zero’) elif x == 1: print(‘Single’) else: print(‘More’)””” #example 1 – type find “””a=5 print(a,”is type of”, type(a)) b=2.5 print(b,”is type of”, type(b))””” #example 2 – set “””a={5,2,3,1,4} print(“a=”,a) print(type(a))””” #example 3 – printing same sentence for n times “””for eachPass in range(4): print(“it is alive”, end=” “)””” #example 4 – Printing series of 2 (2n) “””number=2 exponent=3 product=1 for eachPass in range(exponent): product=product*number print(product, end=” “)””” #example 5 – Find product of numbers “””product=1 for count in range(4): product=product*(count+1) print(product)””” #example 6 – addition of numbers in a range defined “””lower=int(input(“enter the lower bound “)) upper=int(input(“enter the upper bound “)) sum=0 for count in range(lower,upper+1): sum=sum+count print(“sum is”, sum)””” #example 7 – working with list “””x=list(range(1,6,2)) print(x)””” #example 8 – addition of even numbers in a range defined “””sum=0 for count in range(2,11,2): sum+=count print(sum)””” #example 10 – find maximum and minimum “””first=int(input(“enter the first number “)) second=int(input(“enter the secomd number “)) if first>second: maximum=first minimum=second else: maximum=second minimum=first print(“maximum”,maximum) print(“minimum”,minimum)””” #example 11 – find maximum and minimum using built-in function “””first=int(input(“enter the first number “)) second=int(input(“enter the secomd number “)) print(“maximum”,max(first,second)) print(“minimum”,min(first,second))””” #example 12 – adding the the user input numbers “””sum=0.0 data=input(“enter a number or just enter to quit”) while data != “”: number=float(data) sum+=number data=input(“enter a number or just enter to quit”) print(“the sum is”, sum)””” #example 14 – while Loop and break statement “””sum=0.0 while True: data=input(“Enter a number or just enter to quit: “) if data ==””: break number=float(data) sum=sum+number print(“The sum is”, sum)””” #example 15 – while Loop and break statement “””while True: number=int(input(“Enter a number or just enter to quit: “)) if number >=0 and number <=100: break else: print(“not in range”) print(number)””” #example 16 – fibonacci sequence “””a, b = 0, 1 while b < 10: print(b, end=” “) a, b = b, a+b””” #example 17 – Number guess problem “””number = 23 running = True while running: guess = int(input(‘Enter an integer : ‘)) if guess == number: print(‘Congratulations, you guessed it.’) running = False # this causes the while loop to stop elif guess < number: print(‘No, it is higher than that.’) else: print(‘No, it is a little lower than that.’) print(‘Done’)””” #example 18 – Country Name and Length “””country = [‘Australia’, ‘America’, ‘Austria’] for c in country: print (c, len(c))””” #example 19 – Length of a string “””while True: #runs only when it is true s = input(‘Enter something : ‘) if s == ‘quit’: break print(‘Length of the string is’, len(s)) print(‘Done’)”””

Order from us and get better grades. We are the service you have been looking for.