Assignment Python
Assignment Python
"""
@author: GSB
"""
a=int(input("Enter a year"))
if a%4==0:
print("It is a leap year")
else:
print("it is not a leap year")
a=int(input("Enter age"))
if a>=18:
print("Eligible for voting")
else:
print("Not eligible for voting")
a=int(input("Enter age"))
if a%4==0:
print("Eligible for voting")
else:
print("Not eligible for voting")
@author: GSB
"""
"hello" + "world"
"hello"*3
"hello"[0]
"hello"[-4:-1]
len("hello")
Str='Python class'
Str.upper()
Str='Python class'
Str.count('s')
Str='Python class'
Str.swapcase()
li=[5,2,6,8]
li.sort()
li
s=[1,2,3]
t=['begin',s,'end']
t
t[1][1]
len(s)
max(s)
min(s)
list(s)
li = 'abcdefghijklmno'
li.count('f')
k = ['abc','def','ghijklmno']
k.append('def')
k
fruits=['apple','banana','cherry']
cars=['ford','bmw']
fruits.extend(cars)
cars
fruits=['apple','banana','cherry']
fruits.remove('apple')
fruits
tu=(23,45,'abc')
tu[1]