log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Query about python
 
  Query about python
  eddie_keating (19:13 26/2/2005)
  eddyosaysyo2 (12:36 27/2/2005)
 
Eddie Keating Message #86415, posted by eddie_keating at 19:13, 26/2/2005
AA refugee
Posts: 1
Hi

I am trying to code a small script to take in 6 chars (for transmission across a wire). At the other end I am trying to unencode. Here is my script

val1 = ord((raw_input("Enter char 1: "wink))
val2 = ord((raw_input("Enter char 2: "wink))
val3 = ord((raw_input("Enter char 3: "wink))
val4 = ord((raw_input("Enter char 4: "wink))
val5 = ord((raw_input("Enter char 5: "wink))
val6 = ord((raw_input("Enter char 6: "wink))

mask = 255

tot = (((((((((val1 << cool + val2) << cool + val3) << cool + val4) << cool + val5) << cool + val6

char6 = tot & mask

temp = tot - char6 >> 8

char5 = temp & mask

temp = temp - char5 >> 8

char4 = temp & mask

temp = temp - char4 >> 8

char3 = temp & mask

temp = temp - char3 >> 8

char2 = temp & mask

temp = temp - char2 >> 8

char1 = temp & mask

print chr(char1)
print chr(char2)
print chr(char3)
print chr(char4)
print chr(char5)
print chr(char6)

However when i try and run this i get some problems. I have a python warning and then

when i use the chars a b c d e f

i only receive back out c d e f

That is to say the first two chars in and hence the last two out and blank

ANy ideas?

Thanks

Eddie

  ^[ Log in to reply ]
 
Eddy Willson Message #86416, posted by eddyosaysyo2 at 12:36, 27/2/2005, in reply to message #86415
AA refugee
Posts: 186
Whoops smiley code seems to have got you there.

I reccomend These Python forums

  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Query about python