User Tools

Site Tools


software_carpentry

Basic

Editors

  1. Create a file using cat with all the names of your friends.
  2. Concatenate the file with some other names
  3. Search for a name in the file using sed
  4. Replace a name with another using sed. Redirect it to another file name.
  5. Search for the name in the file using Nano
  6. Write a Hello world program in emacs
  7. Split the windows in emacs
  8. Find out copy and paste in emacs. Also, about M-x increase-left-margin

Python

  1. Find out the area of a rectangle with length = 10 and breadth = 20
  2. Find the maximum number in [1,30,99,43,21]
    1. Check what max(list) does
  3. Implement Linear search using lists
    1. Take a list, implement a loop such that the program prints the index of a particular item in the list.
  4. Take a string using raw_input and replace all a's in the string with b's
  5. Take a string using raw_input and check if it is a palindrome
    1. Check reversed
  6. Make an English to telugu dictionary with 10 english words as the keys and telugu words as values. Now, make some strings with the dictionary
  7. Print this
P
Py
Pyt
Pyth
Pytho
Python
  1. Take an input from the user which can be “heads” or “tails”. Now, get a random number which is 0 and 1 from python using random. Print “Success” if input is heads and the random number is 0 or if input is tails and random number is 1. Else, print “Fail”
  2. A program that prints “Panagram” if a given sentence is a pangram (A pangram is a sentence that contains all the letters of the English alphabet at least once, for example: The quick brown fox jumps over the lazy dog. Your task here is to write a function to check a sentence to see if it is a pangram or not. )
  3. Write a function called “morph” which takes a string and replaces all a's in the string and replaces them with o's and replaces all e's with i's.
  4. Write a function called “common” which takes two lists l1 and l2 and returns the common items in a list.

Intermediate

  1. Here is a description of the “Lucky 7” Game:

You start of by asking the user to choose from 3 sets (Hint :: Use raw_input)

  1. Any number below 7 (0-7)
  2. Exactly 7
  3. Any number above 7 (7-12)

After the user chooses, you have to roll your dice and see the outcome

  1. If the number on the dice is < 7 and user chooses 1, then he wins. Else, he loses
  2. If the number on the dice is = 7 and the user chooses 2, he wins, Else he loses
  3. If the number on the dice is > 7 and the user chooses 3, he wins, Else he loses

Task : Write a python program to stimulate the lucky 7 program .. Hint : Use random module

  1. Write a function called “shift” which takes a list l1 and a number n. The function should insert n number of zeros in front of the list and discard the last n number of digits already present in the list.
    • shift([1,2,3,4],1) must return [0,1,2,3]
    • shift([1,2,3,4],2) must return [0,0,1,2]
software_carpentry.txt · Last modified: 2018/03/24 11:13 (external edit)