Wednesday, 12 January 2022

Programmes Part 1:


#list of things to be displayed whatever which are entered#
list = input('enter list of items:')
total = [list]

while list != '':



    list = input('enter list of items:')
    total.append(list)









else:
    print('list of things to do for today:')
    for i, list in enumerate(total, start=1):
        print(i,list)

#list of things to be displayed which are in dictionary#
people = {'john': 'he plays guitar', 'Sachin': 'master blaster'}

people['Karuna'] = 'An Artist'

people['john'] = 'he plays drums and guitar too'
for person, qualities in people.items():
    print('quality for {0} is {1}. '.format(person, qualities))


# To get maximum value from the dictionary #
Grades = {'Nataraj': 50, 'Manishi': 60, 'Ambootu': 20}

print(max(Grades.items()))



class student():
    def getstudentdetails(self):
        self.firstname = input('enter student first name')
        self.lastname = str(input('enter you student last name'))
        self.age = input('enter your age')
        self.Score = int(input('enter your test score'))
        self.Scholarship = input('Please enter Yes or NO')


s1 = student()
s1.getstudentdetails()
x = s1.Score
if x >= 60:
    print(f'{s1.lastname} Student is eligible for admission')
else:
    print(f'{s1.lastname} Student is not eligible for admission')
if x >= 80:
    print(f'{s1.lastname} Student is eligible for scholarship')



num = int(input('enter a number'))
if(num % 2) == 0:
    print(f"{num} is Even")
else:
    print(f"{num} is odd")






name continent area population gdp
Afghanistan Asia 652230 25500100 20343000000
Albania Europe 28748 2831741 12960000000
Algeria Africa 2381741 37100000 188681000000
Andorra Europe 468 78115 3712000000
Angola Africa 1246700 20609294 100990000000
...


In this tutorial you will use the SELECT command on the table world:


Show the name and population for France, Germany, Italy





item =input('enter item:')
cost = input('enter cost of the item')

items = []
Price = []


while item != '' and cost != '':
    items.append(item)
    Price.append(cost)
    item = (input('enter item:'))
    cost = input('enter cost of the item')



ration = {}


for i in range(0,len(items)):
  ration[items[i]] = Price[i]




print(ration)



No comments:

Post a Comment

Notes: 16th Jan