Sign In
Not register? Register Now!


Pages:
4 pages/≈1100 words
Sources:
Check Instructions
Style:
Check Instructions
Subject:
IT & Computer Science
Type:
Others
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 10
Topic:

Writing Program Python and Python Code

Instructions:

pppppppppppppppppppppppppppppppppppppppppppppppppssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssstttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww

Content:


Subject: Sp22-bai-025 BASI LAB#1



Task_1

Write a program that prompts the user to input an integer and then outputs the number with the digits reversed. For example, if the number is 12345, the output should be 54311.

n=input ("Enter an integer")

print("Reverse number of",n,"is",n[::-1])

print("\n")

Output:


Task_2

Write a program python that reads a set of integers, and then prints the sum of the even and odd integers.

intger_string = input ("Enter several integers ")

sum_even= 0

sum_odd=0


for integer in intger_string.split(" "):

    integer = int (integer)


    if integer % 2:

        sum_odd +=integer

    else:

        sum_even+=integer


print ("Sum of even integrs is : ",sum_even)

print ("Sum of odd integrs is : ",sum_odd)


Output:



Task_3

Fibonacci series is that when you add the previous two numbers the next number is formed. You have

to start from 0 and 1.

E.g. 0+

Get the Whole Paper!
Do you need a custom essay? Order right now:
Need a Custom Essay Written?
First time 15% Discount!