daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def main():
  2.     choice = int(input("Ievadiet skaitli 1 , lai apskatitu 1.1, 2, lai apskatitu 1.2 uzdevumu ==> "))
  3.    
  4.     if choice == 1:
  5.         print("Uzdevums 1.1.")
  6.         uzd_11()
  7.         print("\n")
  8.         print("Uzdevums 1.2")
  9.         uzd_12()
  10.        
  11.     elif choice == 2:
  12.         print("Uzdevums 1.2")
  13.         uzd_12()
  14.         print("\n")
  15.         uzd_11()
  16.     else:
  17.         main()
  18.  
  19. def uzd_11():
  20.     dalitaju_sk = 0
  21.     x = int(input("Ievadiet veselu pozitivu skaitli"))
  22.     if x > 0:
  23.         for i in range (1,x + 1):
  24.             if x % i == 0:
  25.                 dalitaju_sk += 1
  26.         print(dalitaju_sk)
  27.     else:
  28.         print("Nuuuu, sitam nevajadzeja notikt")
  29.    
  30. def uzd_12():
  31.     list = []
  32.     n = 0
  33.     para_sk = 0
  34.     nepara_sk = 0
  35.     while n != 5:
  36.         x = int(input("Ievadiet veselu pozitivu skaitlu ==> "))
  37.         list.append(x)    
  38.         if x % 2 == 0:
  39.             para_sk += 1
  40.             print("Ievaditais skaitlis ir pozitivs skaitlis.")
  41.             if (x % 4 == 0) and (x % 10 == 0):
  42.                 print("Ievaditais skaitlis vienlaikus dalas gan ar 4, gan ar 10")
  43.         else:
  44.             if x > 1:
  45.                 for i in range(2,x):
  46.                     if (x % i) == 0:
  47.                        print("Ievaditais skaitlis NAV pirmskaitlis")
  48.                        print(i," * ",x//i," = ",x)
  49.                        break
  50.                 else:
  51.                     print(x,"IR pirmskaitlis")
  52.             nepara_sk += 1
  53.         n += 1
  54.            
  55.     print(list)
  56.  
  57.     maxs = list[0]
  58.     for i in list:
  59.         for j in list:
  60.             if (i>j):
  61.                 if i > j and i > maxs:
  62.                     maxs = i
  63.     print("Lielakais saraksta skaitlis ir: " , maxs)
  64.  
  65.     mins = list[0]
  66.     for i in list:
  67.         for j in list:
  68.             if (i<j):
  69.                 if i < j and i < mins:
  70.                     mins = i
  71.     print("Mazakais saraksta skaitlis ir: " , mins)
  72.  
  73.     print("Kopuma ieguvam ", para_sk, "para skaitlus un " , nepara_sk, "nepara skaitlus")
  74.  
  75.  
  76. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top