Posts

Showing posts with the label Quiz

Python Quiz 5 --- "Fibonacci Series"

Python Quiz 5 --- "Fibonacci Series" The PROGRAM or TUTORIAL  is about a "Fibonacci Series" Fibonacci Series  -  The  Fibonacci sequence  is a set of  numbers  that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a  Fibonacci  number) is equal to the sum of the preceding two  numbers . ... F (0) = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 ... SOLUTION: # Fibonacci Series # 0 1 1 2 3 5 8 13 def fibonacci (n): if n == 1 : return 0 elif n == 2 : return 1 else : return fibonacci(n - 1 ) + fibonacci(n - 2 ) number1 = int ( input ( "Enter then number \n " )) print (fibonacci(number1))

Python Quiz 4 ---

 Python Quiz 4 --- Q- Write down a program, which will take input from users, until the number is greater than 100, if the number is greater than 100; it will print 'Congratulations', else the loops has to continue by printing 'Try Again' """ CODE while ( 1 ): num = int ( input ( "Type your Number \n " )) if num> 100 : print ( "Congratulations" ) break else : print ( "Try Again \n " ) continue

Python Quiz 3 - "Using For Loop to see List's value is 'Numeric' and greater than '6' "

 Python Quiz 3 - "Using For Loop to see List's value is 'Numeric' and greater than '6' " CODE list1 = [ "s" , "a" , "b" , "k" , 2 , 3 , 8 , 7 , 10 , 458 , - 1 , - 100 , 6 , 6.56 , 6.000001 ] for items in list1: if str (items).isnumeric() and items> 6 : print (items) """Output --- 8 7 10 458 """

Python Quiz 2 - "Using if, elif statements to see if you're eligible to drive or not"

 Python Quiz 2 - "Using if, elif, else statements to see if you're eligible to drive or not" CODE print ( "Your age is?" ) var2 = int ( input ()) if var2<= 7 : print ( "Age is definetly not eligible for driving" ) elif var2< 18 : print ( "No. You can not drive." ) elif var2== 18 : print ( "We will think about you and you have to come here for inspection." ) elif var2>= 70 : print ( "Age is definetly not eligible for driving" ) else : print ( "Yes. You can drive." )

Python Quiz 1 - Sum of Two Numbers in Python

 Python Quiz 1 - -- "Sum of Two Numbers in Python" This program iss about how we can add two numbers in python OR using python as a calculator. CODE #Quiz 1 - Sum of two numbers print ( "Enter Number 1" ) inpnum1 = input () print ( "Enter Number 2" ) inpnum2 = input () print ( "Sum of these numbers = " , int (inpnum1) + int (inpnum2))