Python Unlimited Anaconda

Thanks for joining me!

1.

print("Please Enter your name")
x = input()
print("Hello,", x)

==========================================================================================================================
2.

print("Enter two numbers")
x, y =map(int,input().split()) #x, y = [int(x) for x in input().split()] can also be taken
suma = x+y
if(suma>0):
    print("Pos")
else:
    print("Negative")

==========================================================================================================================
3.

x= 1234
a = input("Enter the 4 digit PIN:\n")

num = int(a)

while(num is not x ):
    print("Incorrect PIN: Try Again")
    a = input()
    num = int(a)
    if(num == x):
        print("Correct")
        break
    else:
        continue

==============================================================================================================================
4.

FirstName = input("Enter your first name\n")
LastName = input("Enter your Last Name\n")
print("FullName:  "+FirstName+"."+LastName)

==========================================================================================================================
5.

name = input("Enter a string\n")
print(name.swapcase()) 

-----------------------------------------------------------------------------------------------------------------------

#the following program is for toggle case #chutzpah from StackOverflow
name=input("Enter your Chutzpah naam")
for i in name:
    if i.isupper():
        print( i.lower(),sep='',end='')
    else:
        print( i.upper(),sep='',end='')

    
===========================================================================================================================    
6.

a = list(map(str, input("Say\n").split()))
print(a)
b = sorted(a, key = len)

print("The longest %s",(b[-1], len(b[-1])))
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a = list(map(int, input("Give the list\n").split()))
b=1
c=0

for i in a:
    b *= i #b has to be 0(zero) as anything multiplied by zero is zero
    c += i #have to initialize
print(a)
print(b)
print(c)




===========================================================================================================================
8.


a = list(map(int, input("list 1\n").split()))
b = list(map(int, input("list 2\n").split()))
x=0
print(any(true for x in a for x in b))
        
---------------------------------------------------------------------------------------           
            
a = list(map(int, input("list 1\n").split()))
b = list(map(int, input("list 2\n").split()))
c = []
for i in a:
    if i in b:
        c.append(i)
if c:
    print("These are the letters",c)
else:
    print("Not similar")
        

==============================================================================================================
9.


a = list(map(int, input("list").split()))
for i in a:
        print("*" *i)

Good company in a journey makes the way seem shorter. — Izaak Walton

post

Leave a comment