Advertisement
TermSpar

Python Basics

Jun 13th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. user_name = input("Enter Your Name: ");
  2. print("Hello", user_name);
  3.  
  4. #########################################
  5.  
  6. loop_count = int(input("Enter How Many Loops: "));
  7. for i in range(1, loop_count):
  8.     print(i, "\n");
  9.  
  10. ###########################################
  11.  
  12. def oddOrEven(num):
  13.     remainder = num % 2;
  14.  
  15.     if remainder == 0:
  16.         print(num, "is even");
  17.     else:
  18.         print(num, "is odd");
  19.  
  20. user_num = int(input("Enter Value to Check: "));
  21. oddOrEven(user_num);
  22.  
  23. ##############################################
  24.  
  25. user_array = [None];
  26.  
  27. ray_size = int(input("Enter Array Size: "));
  28. user_array = [None] * ray_size;
  29.  
  30. for i in range(0, ray_size):
  31.     name = input("Enter Name: ");
  32.  
  33.     user_array[i - 1] = name;
  34.  
  35. for i in range(0, ray_size):
  36.     print(user_array[i - 1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement